I have a many-to-many relationship: The user has several organizations through branches and vice versa.
I use declarative organizations, and I want the user to edit a specific organization if it is affiliated, and the affiliationtype attribute of the membership is a specific value.
Thus membership has 3 columns, user_id, organization_id and affiliationtype_id
I can do:
o = Organization.find(:first) o.affiliatons[0].user and get the user
Now I want to do this:
has_permission_on [:organizations], :to => :edit do if_attribute (...) end
This if_attribute should see if the current user is an organization. Affiliate [?]. user and if organization. affiliate [?]. affiliationtype_id = "3"
Hope this is a syntax problem ... I really need to get this work to work.
ruby-on-rails declarative-authorization
Victor martins
source share