Forum: Ruby on Rails Constructing for administrators?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Bob S. (Guest)
on 2008-11-26 11:14
I'm using the restful_authentication's current_user. So to find a user's
recipes, I use:

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 :

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?
Rick (Guest)
on 2008-11-27 08:52
(Received via mailing list)
You might think of an index all that is accessible only to admin.

before_filter :check_admin_role, :only => [:index]


On Nov 25, 11:14 pm, Bob S. <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.