Download Free Ebooks. Download Self Development Books. Download Comic Books. Download Batman Dark Knight. Download Audiobooks Books. Download Self Help Books. Download Project Management Books.Download Management Books.Download Leadership Development Books. Download Religion and Spirituality Books. Download Soft Skills Development Books. Download Self Finance Books. Download Sales and Marketing Books. Download Business DEvelopment Books.
Tuesday, 22 May 2012
rails polymorphic has_many: Menuable?
I want to have a Menu class which can point to either another submenu or and "endnode" like a Post or a Category class Menu < ActiveRecord::Base has_many :endnodes, :polymorphic => true belongs_to :parent_menu, :class_name => "Menu", :foreign_key => "parent_menu_id" has_many :sub_menus, :class_name => "Menu", :foreign_key => "parent_menu_id", :order => "sort ASC" end class Category
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment