Commit 0fb00124ef3a1a9e5e9b82c870b830338527331f
Committed by
Antonio Terceiro
1 parent
2f2b97f2
Exists in
master
and in
29 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,7 +18,10 @@ class ActiveRecord::Base | ||
18 | def add_role(role, resource) | 18 | def add_role(role, resource) |
19 | attributes = role_attributes(role, resource) | 19 | attributes = role_attributes(role, resource) |
20 | if RoleAssignment.find(:all, :conditions => attributes).empty? | 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 | else | 25 | else |
23 | false | 26 | false |
24 | end | 27 | end |