I have a Member, User, and Address model, with the last two being child
tables to the first. When I create the models in irb, make the
relations and perform the save on the member, all three models are
inserted into the database with the proper relations. However when I do
the same in the controller, only the member is saved.
def create
@member = Member.new(params[:member])
@address = Address.new(params[:address])
@user = User.new(params[:user])
@member.address = @address
@member.user = @user
respond_to do |format|
if @member.save
...
The form is setup properly to allow the address and user data to be
extracted as shown above, ex:
<input id="address_address_2" name="address[address_2]"
size="30"
type="text" value="23-34st" />
<input id="address_address_3" name="address[address_3]"
size="30"
type="text" value="" />
<input id="address_address_4" name="address[address_4]"
size="30"
type="text" value="" />
<input id="user_email" name="user[email]"
size="30" type="text"
value="my_email-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" /
Is there something that I am missing here?
Thanks
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---