Displaying 1 result from an estimated 1 matches for "pagecategory".
Did you mean:
agecategory
2009 Apr 12
0
rails 2.3 nested forms with has_many through checkboxes
...ve to go to another controller/form just to create and edit page
categories.
class Page < ActiveRecord::Base
has_many :category_items, :as => :item, :dependent => :destroy
has_many :page_categories, :through => :category_items, :source
=> :category, :source_type => "PageCategory", :uniq => true
accepts_nested_attributes_for :page_categories, :allow_destroy =>
true, :reject_if => proc { |attrs| attrs.all? { |k, v| v.blank? } }
end
class PageCategory < ActiveRecord::Base
has_many :pages, :through => :category_items, :source
=> :item, :source_type =&...