Topic: Formtastic and nested fields
I hope to finad a solution to my problem in this forum.
I have a formtastic form that should let me add many pictures to an article (very schoolchildren task)
I have an Article model:
class Article < ActiveRecord::Base has_many :pictures accepts_nested_attributes_for :pictures attr_accessor :filename
And I have a Picture model:
class Picture < ActiveRecord::Base belongs_to :article end
This is my form-whosaid?-tastic form, I followed as much as possible the official documentation
<%= semantic_form_for [:admin, @article] do |f| %> <%= f.inputs "Description" do %> <%=f.input :description %> <% end %> ... <%= f.inputs "Gallery" do %> <%= f.semantic_fields_for :picture do |picture| %> <%= picture.input :filename %> <% end %> <% end %> <%= f.actions %> <% end %>
The problem is when I submit I get this message:
unknown attribute: picture
What's wrong? singular and plurals should be ok, or not?
Thanks to all.