Class: Role
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- Role
- Extended by:
- FriendlyId
- Includes:
- MasterModel
- Defined in:
- app/models/role.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods included from MasterModel
Class Method Details
.all_cache ⇒ Object
16 17 18 19 20 21 22 |
# File 'app/models/role.rb', line 16 def self.all_cache if Rails.env == 'production' Rails.cache.fetch('role_all'){ Role.select(:name).all } else Role.select(:name) end end |
.default_role ⇒ Object
28 29 30 |
# File 'app/models/role.rb', line 28 def self.default_role Role.find_by(name: 'Guest') end |
Instance Method Details
#clear_all_cache ⇒ Object
24 25 26 |
# File 'app/models/role.rb', line 24 def clear_all_cache Rails.cache.delete('role_all') end |
#localized_name ⇒ Object
12 13 14 |
# File 'app/models/role.rb', line 12 def localized_name display_name.localize end |