Module: Model::MetaAction

Extended by:
ActiveSupport::Concern
Included in:
Com::MetaAction
Defined in:
app/models/com/model/meta_action.rb

Instance Method Summary collapse

Instance Method Details

#identifierObject



50
51
52
# File 'app/models/com/model/meta_action.rb', line 50

def identifier
  [business_identifier, namespace_identifier, controller_path, (action_name.blank? ? '_' : action_name)].join('_')
end

#nameObject



54
55
56
57
58
59
60
61
62
# File 'app/models/com/model/meta_action.rb', line 54

def name
  t1 = I18n.t "#{[business_identifier, namespace_identifier, controller_name, action_name].join('.')}.title", default: nil
  return t1 if t1

  t2 = self.class.enum_i18n :action_name, self.action_name
  return t2 if t2

  identifier
end

#role_hashObject



46
47
48
# File 'app/models/com/model/meta_action.rb', line 46

def role_hash
  id
end

#role_pathObject



36
37
38
39
40
41
42
43
44
# File 'app/models/com/model/meta_action.rb', line 36

def role_path
  {
    business_identifier.to_s => {
      namespace_identifier.to_s => {
        controller_path => { action_name => role_hash }
      }
    }
  }
end

#sync_from_controllerObject



64
65
66
67
# File 'app/models/com/model/meta_action.rb', line 64

def sync_from_controller
  self.business_identifier = meta_controller.business_identifier
  self.namespace_identifier = meta_controller.namespace_identifier
end