I have 2 model: Company has_many :company_references CompanyReference belongs_to :companies in create form i have multiple entries for references: i am doing in view like : <% for j in 0..2 %> <tr> <td><%= text_field "cr_person_name",j.to_s,:size=>''10'' %></td> <td><%= text_field "cr_company_name",j.to_s,:size=>''10'' %></td> <td><%= text_field "cr_relationship",j.to_s,:size=>''10'' %></td> <td><%= text_field "cr_contact_no",j.to_s,:size=>''10'' %></td> <td><%= text_field "cr_emailid",j.to_s,:size=>''10'' %></td> </tr> <% end%> and saving them like : create action: @company = Company.new(params[:company]) for j in 0..2 @company.company_references << CompanyReference.new({"contact_no" => params["cr_contact_no"][j.to_s], "company_name" =>params["cr_company_name"][j.to_s], "relationship" =>params["cr_relationship"][j.to_s], "emailid" => params["cr_emailid"][j.to_s], "person_name" => params["cr_person_name"][j.to_s], }) end @company.save but i don''t like this method, could anyone suggest best approach -- 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 -~----------~----~----~----~------~----~------~--~---