search for: scoped_finder_condit

Displaying 1 result from an estimated 1 matches for "scoped_finder_condit".

2006 Jun 26
0
How to limit access to model objects based on role?
...; def edit set_category_with_scope(params[:id]) end def update set_category_with_scope(params[:id]) @category.update_attributes(params[:category]) end def set_category_with_scope(*args) Category.with_scope(:find => scoped_options) do @category = Category.find(*args) end end def scoped_finder_conditions @scoped_finder_conditions ||= {:conditions => "positions.company_id = #{current_user.company_id}"} end def scoped_finder_include @scoped_finder_include ||= {:include => :position} end def scoped_options scoped_finder_conditions.merge(scoped_finder_include) end Thanks!...