Permalink
Browse files

Fix issues with Model Inheritance:

  Set the sanction_roles.principal_type to the Child's class, rather than Child's base_class
  • Loading branch information...
1 parent 4c41656 commit 3212858ace0c663042410d0b79841ef964cb180c @pjleonhardt pjleonhardt committed Jul 27, 2010
Showing with 2 additions and 0 deletions.
  1. +2 −0 lib/sanction/principal/grant.rb
View
2 lib/sanction/principal/grant.rb
@@ -40,9 +40,11 @@ def give_permissionable_role(role_name, over)
if(over.class == Class)
role_to_create = self.specific_principal_roles.build(:name => role_name.to_s, :permissionable_id => nil, :permissionable_type => over.to_s)
+ role_to_create.principal_type = self.class.name
role_to_create.save
else
role_to_create = self.specific_principal_roles.build(:name => role_name.to_s, :permissionable_id => over.id, :permissionable_type => over.class.to_s)
+ role_to_create.principal_type = self.class.name
role_to_create.save
end
end

0 comments on commit 3212858

Please sign in to comment.