So I have 2 pages : Welcome & Details.
In the Welcome page, I'm asking the user to input their name and click on a button which takes you to details page. Creates an entry in db with the given name.
In the Details page, I'm asking for the age and gender. These details I'm updating in db against the name entered in the previous page.
Now, these are my two methods.
def welcome
@name = params[:name]
if @fname
then @record= Names.create({:name => @name})
end
end
def details
@human=Names.last
@human.update_attributes({:age=> params[:age], :gender=> params[:gender]})
end
Now, in the above code, instead of using Names.last, i want to use Names.find_by_id(name_id). But how do I pass the name_id value between these methods?
nested_formsinstead of going through this approach. railscasts.com/episodes/196-nested-model-form-revised has a good tutorial.