Sha256: b440253d24088e71b9823784403e4e4e5cea7e16299acea8689b002839a23908
Contents?: true
Size: 1021 Bytes
Versions: 3
Compression:
Stored size: 1021 Bytes
Contents
module Enjoy module Models module Mongoid module Page extend ActiveSupport::Concern module ClassMethods def menu_class_name "Enjoy::Menu" end def menu_class menu_class_name.constantize end end included do field :name, type: String, localize: Enjoy.config.localize, default: "" field :regexp, type: String, default: "" field :redirect, type: String, default: "" field :excerpt, type: String, localize: Enjoy.config.localize, default: "" field :content, type: String, localize: Enjoy.config.localize, default: "" field :fullpath, type: String, default: "" has_and_belongs_to_many :menus, inverse_of: :pages, class_name: menu_class_name acts_as_nested_set scope :sorted, -> { order_by([:lft, :asc]) } scope :menu, ->(menu_id) { enabled.sorted.where(menu_ids: menu_id) } end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
enjoy_cms-0.2.0.2 | lib/enjoy/models/mongoid/page.rb |
enjoy_cms-0.2.0.1.beta | lib/enjoy/models/mongoid/page.rb |
enjoy_cms-0.2.0.beta | lib/enjoy/models/mongoid/page.rb |