Displaying 1 result from an estimated 1 matches for "set_x_with_scope".
2006 Jun 26
0
How to limit access to model objects based on role?
...se one of the access control
systems out there to limit access to the controllers. However, with 9
different controllers this seems like a terrible choice.
Here''s what I''ve come up with. Each controller implements 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 d...