Commit 0fb00124ef3a1a9e5e9b82c870b830338527331f
Committed by
Antonio Terceiro
1 parent
2f2b97f2
Exists in
master
and in
28 other branches
ActionItem1163: made add_role affect objets and not just the database
Showing
1 changed file
with
4 additions
and
1 deletions
Show diff stats
vendor/plugins/access_control/lib/acts_as_accessor.rb
... | ... | @@ -18,7 +18,10 @@ class ActiveRecord::Base |
18 | 18 | def add_role(role, resource) |
19 | 19 | attributes = role_attributes(role, resource) |
20 | 20 | if RoleAssignment.find(:all, :conditions => attributes).empty? |
21 | - RoleAssignment.new(attributes).save | |
21 | + ra = RoleAssignment.new(attributes) | |
22 | + role_assignments << ra | |
23 | + resource.role_assignments << ra | |
24 | + ra.save | |
22 | 25 | else |
23 | 26 | false |
24 | 27 | end | ... | ... |