Hello, help to understand the bunch active_admin - formtastic is the controller:
ActiveAdmin.register Item do controller do def new @item = Item.new @color = @item.ItemColors.build end end
and partial:
<%= semantic_nested_form_for [@item, @color] do |f| %> <p>Category </p><%= f.input :category %></br> <%= f.input :title %> <%= f.input :photo1 %> <%= f.fields_for :ItemColors do |i| %> <%= i.select :DetailColor_id, collection => DetailColor.all %> <%= i.text_field :size %> <%= i.link_to_remove "remove" %> <% end %> <%= f.link_to_add "add", :ItemColors %> <% end %>
when I try to create an Item, I get:
undefined method 'item_item_colors_path' for <#<Class:0x00000003de0348>:0x00000003de2f30>
Shrek: ok, I'll know
1101_debian: ItemColors - model
Model Item:
has_many :DetailColors, :through => :ItemColors accepts_nested_attributes_for :ItemColors, :allow_destroy => true accepts_nested_attributes_for :DetailColors
ItemColor Model:
belongs_to :Item
Model DetailColor:
has_many :Items, :through => :ItemColor