Class: Marty::RoleType

Inherits:
Base show all
Extended by:
PgEnum
Defined in:
app/models/marty/role_type.rb

Constant Summary collapse

VALUES =
[
  'admin',
  'user_manager',
  'dev',
  'viewer',
  'data_grid_editor'
]

Class Method Summary collapse

Methods included from PgEnum

[], _pg_enum?, extended, seed, values

Methods inherited from Base

get_final_attrs, get_struct_attrs, make_hash, make_openstruct, mcfly_pt

Methods inherited from ActiveRecord::Base

joins, old_joins

Class Method Details

.from_nice_names(roles) ⇒ Object



12
13
14
15
16
# File 'app/models/marty/role_type.rb', line 12

def self.from_nice_names(roles)
  Marty::RoleType.get_all.select do |role|
    roles.include?(I18n.t("roles.#{role}", default: role))
  end
end

.to_nice_names(roles) ⇒ Object



18
19
20
21
22
# File 'app/models/marty/role_type.rb', line 18

def self.to_nice_names(roles)
  roles.map do |role|
    I18n.t("roles.#{role}", default: role)
  end
end