I'm trying to figure out how to follow this devise tutorial to add 'approved' to the user model.
I have everything set up as shown in the tutorial, except when I save it all and try to click on the link called:
<%= link_to "Users awaiting approval", :action => "index", :approved => "false" %>
I get an error called:
undefined method `find_all_by_approved' for #<Class:0x007fbc5cf34dd0>
It highlights the second line of this users/index action:
def index
if params[:approved] == "false"
@users = User.find_all_by_approved(false)
else
@users = User.all
authorize @users
end
end
Does anyone know what else needs to be done (besides whats shown in the tutorial) to get this functionality to work?
Probably, you had typo issue. Below one should give you same results.
@users = User.where(approved: false)