You might think of an index all that is accessible only to admin.
before_filter :check_admin_role, :only => [:index]
Rick
On Nov 25, 11:14 pm, Bob Sanders
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> I''m using the restful_authentication''s current_user. So
to find a user''s
> recipes, I use:
>
> current_user.recipes
>
> I want the admin (I have an "admin" column in the users table) to
view
> all recipes. I''m doing this right now, but think its too verbose:
>
> @recipes = current_user.admin? ? Recipe.all : current_uesr.recipes
>
> Is there a more efficient way to have the admin view all recipes (and
> non-admin only to view their own recipes) instead of doing the above?
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---