Skip to content

Commit

Permalink
modify subject to allow for inheritance
Browse files Browse the repository at this point in the history
Signed-off-by: be9 <>
  • Loading branch information
Jeff Jaco authored and be9 committed Sep 25, 2009
1 parent 93fb672 commit 184e241
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/acl9/model_extensions.rb
Expand Up @@ -37,8 +37,9 @@ def acts_as_authorization_subject(options = {})

has_and_belongs_to_many :role_objects, :class_name => role, :join_table => join_table

cattr_accessor :_auth_role_class_name
cattr_accessor :_auth_role_class_name, :_auth_subject_class_name
self._auth_role_class_name = role
self._auth_subject_class_name = self.to_s

include Acl9::ModelExtensions::Subject
end
Expand Down
2 changes: 1 addition & 1 deletion lib/acl9/model_extensions/subject.rb
Expand Up @@ -161,7 +161,7 @@ def delete_role(role)
if role
self.role_objects.delete role

role.destroy if role.send(self.class.to_s.demodulize.tableize).empty?
role.destroy if role.send(self._auth_subject_class_name.demodulize.tableize).empty?
end
end

Expand Down

0 comments on commit 184e241

Please sign in to comment.