orbit4-5/app/models/module_app.rb

32 lines
640 B
Ruby

class ModuleApp
include Mongoid::Document
include Mongoid::Timestamps
field :title, type: String
field :key, type: String
field :sidebar_order,type: Integer,default: 0
has_many :categories, dependent: :destroy, :autosave => true
def get_registration
OrbitApp::Module::Registration.find_by_key(key)
end
def self.find_by_key(key)
self.find_by(:key => key)
end
def module_name
I18n.t(get_registration.get_label_i18n)
end
def label
I18n.t(label_i18n)
end
def label_i18n
reg = get_registration
reg.nil? ? 'Init is not defined completely' : get_registration.get_label_i18n
end
end