Sha256: 4153d88c7aca2920c82b7871dc7e90d7b562b2efd99a4a0bbdaebeb189dd8586
Contents?: true
Size: 1.54 KB
Versions: 10
Compression:
Stored size: 1.54 KB
Contents
module Enjoy module Models module Mongoid module Page extend ActiveSupport::Concern include Enjoy::HtmlField included do if defined?(RailsAdminComments) include RailsAdminComments::Commentable end belongs_to :connectable, polymorphic: true scope :connected, -> { where(:connectable_id.ne => nil) } scope :unconnected, -> (except_this = nil) { if except_this where({"$or" =>[ {:connectable_id => nil}, {"$and" => [ {connectable_type: except_this.class.to_param}, {connectable_id: except_this._id} ]} ]}) else where(:connectable_id => nil) end } field :name, type: String, localize: Enjoy.config.localize, default: "" field :regexp, type: String, default: "" field :redirect, type: String, default: "" enjoy_cms_html_field :excerpt, type: String, localize: Enjoy.config.localize, default: "" enjoy_cms_html_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: "Enjoy::Menu" 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
10 entries across 10 versions & 1 rubygems