Class: Role

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/role.rb

Instance Method Summary collapse

Instance Method Details

#list_featuresObject



19
20
21
22
23
24
25
26
27
28
# File 'app/models/role.rb', line 19

def list_features
  list = feature_permissions.map do |fp|
    name = I18n.t("admin.features.#{fp.feature.name}")
    name = fp.feature.name if name.include? 'translation missing'
    name += ' (Read-Only)' if fp.read_only
    name
  end

  list.sort.join(', ')
end

#read_only_featuresObject



9
10
11
12
13
14
15
16
17
# File 'app/models/role.rb', line 9

def read_only_features
  list = []

  feature_permissions.each do |fp|
    list << fp.feature if fp.read_only
  end

  list
end