Displaying 1 result from an estimated 1 matches for "set_category_with_scope".
2006 Jun 26
0
How to limit access to model objects based on role?
...nts something like the
following code. Basically, there''s a set_x_with_scope method which takes
normal find() parameters, then passes them to X.find within X.with_scope.
So, instead of having @category = Category.find(param[:id]), which would
occur multiple times in the controller, I use
set_category_with_scope(params[:id]), which sets @category and only allows
access to data based on attributes of the current user.
Right now, I use a collection of methods to build the options for :find in
with_scope. Soon, I''m going to alter the methods so that their return values
will depend on the user'...