Sha256: 6c575356fe5435434d34202dcc4f6e64974b96844c0e38bc062d0e93ed8f3eb1

Contents?: true

Size: 542 Bytes

Versions: 3

Compression:

Stored size: 542 Bytes

Contents

module Enjoy
  module Models
    module Mongoid
      module Menu
        extend ActiveSupport::Concern

        module ClassMethods
          def page_class_name
            "Enjoy::Page"
          end

          def page_class
            page_class_name.constantize
          end
        end
        
        included do
          has_and_belongs_to_many :pages, inverse_of: :menus, class_name: page_class_name
          alias_method :items, :pages

          field :name, type: String, default: ""
        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/menu.rb
enjoy_cms-0.2.0.1.beta lib/enjoy/models/mongoid/menu.rb
enjoy_cms-0.2.0.beta lib/enjoy/models/mongoid/menu.rb