Hi Igor
You can use the conditions_for_collection in your controller .
For example,
# must be after config block to work
def conditions_for_collection
if ! (current_user.is_admin or current_user.is_hr)
["staff = ?", current_user.login]
end
end
On Aug 28, 5:39 am, "Igor K."
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> Hi all,
> I need a help to solve problem withActiveScaffold,
> Imagine that you have a list of companies, each company has a list of
> products. If I''m administrator of some company and I want to edit
my
> products I also can see(not edit, editing/deleting is possible to
> disable) other companies products.
> I need to useactivescaffoldfor displaying/editing only data that
> connected to company that loggined by current user(of course product
> model has a company_id, by I don''t know how to filter this data).
> Thank you for any help and advices
> Have a nice day!
> --
> 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---