Skip to content

Commit

Permalink
Fix #614 and make it explicitly clear that asset_type is class name
Browse files Browse the repository at this point in the history
  • Loading branch information
CloCkWeRX committed Dec 14, 2017
1 parent 59d9567 commit f33377a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/fat_free_crm/permissions.rb
Expand Up @@ -44,7 +44,7 @@ def #{model}_ids=(value)
permissions_to_remove = Permission.where(
#{model}_id: self.#{model}_ids - value,
asset_id: self.id,
asset_type: self.class
asset_type: self.class.name
)
permissions_to_remove.each {|p| (permissions.delete(p); p.destroy)}
(value - self.#{model}_ids).each {|id| permissions.build(:#{model}_id => id)}
Expand All @@ -69,7 +69,7 @@ def access=(value)
def remove_permissions
# we don't use dependent => :destroy so must manually remove
if id && self.class
permissions_to_remove = Permission.where(asset_id: id, asset_type: self.class.to_s).to_a
permissions_to_remove = Permission.where(asset_id: id, asset_type: self.class.name).to_a
else
permissions_to_remove = []
end
Expand Down

0 comments on commit f33377a

Please sign in to comment.