if u.role_list.include? 'northern_regional_manager' 
  can [:read, :update, :create], Dealer, region: 'Northern'

  # can :blah all teh Blahs of northern dealers
  # assuming Blah.belongs_to :dealer
  can [:read, :update, :create], [Address, Employee], dealer: { region: 
'Northern' }
end

PS I think you can model your data better in a more generic way

marți, 26 februarie 2013, 02:07:21 UTC+2, Tim Uckun a scris:
>
> I am trying to integrate with cancan and following the instructions on 
> the wiki I was able to set up various roles, permissions etc and the 
> records magically filter themselves which is great.  I am now stuck on 
> how to deal with dependent records though. 
>
> Here is the scenario. 
>
> I have regional managers 
>
>  if u.role_list.include? 'northern_regional_manager' 
>       can [:read, :update, :create], Dealer,   :region => 'Northern' 
>  end 
>
> The dealer has_many various items (addresses, employees etc) it also 
> has_one some things. I would like to grant the regional manager the 
> ability to read, update and create (and delete) the related records. 
> For example the regional manager can delete an employee for the dealer 
> but can't delete the dealer itself. 
>
> What's a good way to handle this? 
>

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/activescaffold?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to