Ok, I figured out how to do it, but now I''m having soe trouble.
I want to be able to add model_2''s to model_1, when model_1 already
exists
def save_model_1
current_model_1 = Model_1.find(params[:model_1])
if current_model_1
@model_2 = current_model_1.model_2s.build(params[:model_2])
else
@model_1 = Model_1.new(params[:model_1])
@model_2 = current_model_1.model_2s.build(params[:model_2])
end
if current_model_1
render :action => ''index''
else
if @model_1.save
render :action => ''index''
else
render :action => ''new_model_1''
end
end
end
I get this error:
ArgumentError in Auth userController#save_model_1
Unknown key(s): title
In new_model_1.html.erb:
<%= text_field :model_1, :title %>
Any ideas?
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
-~----------~----~----~----~------~----~------~--~---