当前位置: 动力学知识库 > 问答 > 编程问答 >

ruby on rails - Devise users - show only the false boolean

问题描述:

I would like to show in my index the users that are waiting to be approved (false = unnaproved). I followed the steps in this link(controllers and views):

https://github.com/plataformatec/devise/wiki/How-To%3a-Require-admin-to-activate-account-before-sign_in

I have tried many ways, but nothing seems to work. My code is:

controller:

def index

if params[:approved] == "false"

@users = User.find_by_approved(false)

else

@users = User.all

end

end

View index

<% @users.each do |users| %>

<tr>

<td><%= users.name%></td>

<td><%= users.email %></td>

<td><%= users.approved %></td>

<td><%= link_to "Aprobar", desaprobado_path(users) %></td>

</tr>

<%end%>

The index show me all the users (false and true), not only the false ones.

Any idea? thanks! greetings from Chile and excuse my english.

分享给朋友:
您可能感兴趣的文章:
随机阅读: