Tuesday, January 10, 2012

[Rails] what wrong in this nested form?

I have:

class Company < ActiveRecord::Base
has_many :categorizations
has_many :categories, :through => :categorizations
has_many :managements
has_many :managers, :through => :managements
has_many :tenders
has_many :documents, :dependent => :destroy

accepts_nested_attributes_for :managers
accepts_nested_attributes_for :documents
accepts_nested_attributes_for :categorizations

then the form is:

= semantic_form_for @company do |f|
= f.input :name
= f.semantic_fields_for :manager do |manager|
= manager.inputs :name, :fiscal_code, :city, :zip_code, :address,
:street_number, :tel, :email

when I submit the form raise the error:

unknown attribute: manager


{"utf8"=>"✓",
"authenticity_token"=>"V5GsRKLK8cRrGuUh2Jv4DB9wSYWG8ASCxHkd0Ur3o8s=",
"company"=>{"manager"=>{"name"=>"",
"fiscal_code"=>"",
"city"=>"",
"zip_code"=>"",
"address"=>"",
"street_number"=>"",
"tel"=>"",
"email"=>""}},
"commit"=>"Create Company"}

I think there is nothing wrong but perhaps I miss something.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate