Module: Model::MetaBusiness

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

Instance Method Summary collapse

Instance Method Details

#meta_namespacesObject



33
34
35
# File 'app/models/com/model/meta_business.rb', line 33

def meta_namespaces
  MetaNamespace.where(identifier: MetaController.unscope(:order).select(:namespace_identifier).where(business_identifier: identifier).distinct.pluck(:namespace_identifier)).order(id: :asc)
end

#nameObject



20
21
22
23
24
25
26
27
# File 'app/models/com/model/meta_business.rb', line 20

def name
  return super if super.present?

  t = I18n.t "#{identifier}.title", default: nil
  return t if t

  identifier
end

#role_hashObject



43
44
45
# File 'app/models/com/model/meta_business.rb', line 43

def role_hash
  meta_namespaces.each_with_object({}) { |i, h| h.merge! i.identifier => i.role_hash(identifier) }
end

#role_pathObject



37
38
39
40
41
# File 'app/models/com/model/meta_business.rb', line 37

def role_path
  {
    identifier => role_hash
  }
end

#tr_idObject



29
30
31
# File 'app/models/com/model/meta_business.rb', line 29

def tr_id
  "tr_#{identifier.blank? ? '_' : identifier}"
end