On Sun, Oct 25, 2009 at 3:23 PM, Misiek Sz <[email protected]> wrote: > > THank you for helping me out. So, I went through association guide, but > still I can't get it to work. My concept is this. > Display a form to create a new EducationPLan. On the form have a text > box and when the value is entered it doesn't create an association yet, > but returns student record(if found), which then is saved together with > the form. > Is this concept correct? > I can render student info on the education_plan form fine, but is > possible to have that information handled and have that 1-1 relationship > saved when the form is submitted?
OK, now the situation is clearer for me. There's something you're not getting from associations, let's see if with the example you get it more clear. If you want to create the association when you create the education plan, why would you try to get it on the get_info action and not on the create action? When you get (render) the student info on the create form for education plan, you should keep the student id and send it with the rest of the education plan parameters as the education_plan[student_id]. Then, in the create action, you can do EducationPlan.new(params[:education_plan]) (or whatever your params are called) and, if you have the right student_id the relationship should be created automatically. If it doesn't work, you should "pastie" your code so we can debug it better. Hope it helps. -- Leonardo Mateo. There's no place like ~ --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

