Sha256: 41563602ff77d49af30ba9466688039d16ef0994f8f83e9d4ea0fc408ec75680
Contents?: true
Size: 507 Bytes
Versions: 1
Compression:
Stored size: 507 Bytes
Contents
Spree::Role.class_eval do has_and_belongs_to_many :permissions, :join_table => 'spree_roles_permissions', :class_name => 'Spree::Permission' validates :name, uniqueness: true, allow_blank: true def ability(current_ability, user) permissions.each do |permission| permission.ability(current_ability, user) end end def has_permission?(permission_title) permissions.pluck(:title).include?(permission_title) end scope :default_role, lambda { where(:is_default => true) } end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spree_admin_roles_and_access-2.0.0 | app/models/spree/role_decorator.rb |