Vijayendra Achar
2007-Aug-30 09:34 UTC
inserting multiple tuple into the database from single form
Hi friend I want to add 5 user names from a single form . but 5 will be inserted into different tuple . how to do that . please help me -- 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 -~----------~----~----~----~------~----~------~--~---
Jack Zhan
2007-Aug-30 14:47 UTC
Re: inserting multiple tuple into the database from single form
<% for i in 1..5 %> <%= render :partial=>''user'', :locals => { :index => i } %> <% end %> in your _user.rhtml: <%= text_field "user_#{index}", ''field_name'' %> <%= text_field "user_#{index}", ''field_name_2'' %> in your controller: for i in 1..5 user = User.new(params["user_#{index}"]) user.save end when you do the batch edit, it is quite the same way. On Aug 30, 5:34 am, Vijayendra Achar <rails-mailing-l...@andreas- s.net> wrote:> Hi friend > > I want to add 5 user names from a single form . but 5 will be > inserted into different tuple . how to do that . please help me > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---