lib/enjoy/models/mongoid/menu.rb in enjoy_cms-0.1.0.beta1 vs lib/enjoy/models/mongoid/menu.rb in enjoy_cms-0.2.0.beta
- old
+ new
@@ -1,9 +1,20 @@
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: ""