Hi, I'm struggling with the simplest nested form and I can't really find any information about my problem after an hour of googling.
Here is the thing: I have a contract model that belongs_to a kid model, I'm trying to create a form for contract and create at the same time with nested form, the kid. so my "new" action does that @contract = Contract.new @contract.kid.build my form is (I'm using haml for the template): - form_for :contract, @contract,:url => { :action => "create" }, :html => {:multipart => true} do |contract| - contract.fields_for :kid, @contract.kid do |kid| = kid.text_field :name = contract.text_field :start = contract.text_field :end = contract.submit "submit" and at last my "create" action is: @contract = Contract.new(params[:contract]) if !...@contract.save respond_to do |format| format.html { render :action => "new" } end else respond_to do |format| format.html { redirect_to(@kid) } end The problem is that I get an ActiveRecord::AssociationTypeMismatch on the line: @contract = Contract.new(params[:contract]) that says that it was expecting a Kid model with a particular hash and that instead it gets something with a different hash. I can't figure out what's going on because if I try to create a Kid object on its own with params[:contract][:kid] it works, so I guess the kid object from the form is a good one. Any clue anyone ? I would like to try to do the things right and as simple as possible without particular trick. thanks -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-c...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.