Active Scaffold + attachment

Hi all,
I need a help to solve problem with ActiveScaffold,
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 use activescaffold for 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!

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]

On Aug 28, 5:39 am, “Igor K.” [email protected]