On Jan 25, 7:34 pm, mark <aussi...@gmail.com> wrote:
> Hey guys & ladies!
>
> I've got the following relationship which i'm trying to get
> accepts_nested_attributes to work with. But when i submit my form, it
> looks as if its expecting a Company object, rather than an array of
> companies. which really doesn't make sense considering its a
> has_many :relationship.
>
> So what i'm after, is a way to
> accept_nested_attributes_for :companies, so when my users sign up to
> the website, they can also create a company.
>
>
[snip]
> Parameters:
>
> {"commit"=>"Sign up",
>  "user"=>{"password_confirmation"=>"12341234",
>  "companies"=>{"name"=>"1234"},
>  "firstname"=>"driver",
>  "surname"=>"asdf",
>  "password"=>"12341234",
>  "email"=>"a...@asdf.com"}}

Your models and forms look OK, but something has gone wrong in the
generated HTML code - the 'companies' key should be
'companies_attributes' to trigger the nested attributes stuff. Can you
post the generated HTML?

--Matt Jones

-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to