Sha256: 186d40801623bb51354d3414878df8f9faffd774973e45169afee58ab4adf5fc
Contents?: true
Size: 462 Bytes
Versions: 1
Compression:
Stored size: 462 Bytes
Contents
module PagesCore module HasRoles extend ActiveSupport::Concern def role?(role_name) role_names.include?(role_name.to_s) end alias has_role? role? def role_names roles.map(&:name) end def role_names=(names) new_roles = names.map do |name| if role?(name) roles.find_by(name: name) else roles.new(name: name) end end self.roles = new_roles end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pages_core-3.5.1 | app/models/concerns/pages_core/has_roles.rb |