Forum: Ruby on Rails inserting multiple rows in the table ?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
swathi mamadgi (Guest)
on 2007-01-26 23:41

I have to insert multiple rows into the table.

For each useraction as written below,i should insert userid and
similar(checkbox) into the relations table.But everytime only the first
useraction is entered in one row of table.I want to insert multiple rows
for all the useractions.Let me know if anyone has any clue abt
this.Thank You!

<%= form_tag(:controller => 'content' , :action => "save" ) %>
<% for @user_action in @user_actions %>
userid <%= @user_action.user_id%>
Similar<%= check_box("relation", "similar") %>
<%= submit_tag "CreateRelation" %>
<%= end_form_tag %>

Controller code:
def save
  @relation = Relation.create(params[:relation])
  @relation.userid =!
  redirect_to :action => 'index'
Bill W. (Guest)
on 2007-01-27 00:39
(Received via mailing list)
Hi Swathi,

swathi mamadgi wrote:
> I have to insert multiple rows into the table.

Are you talking about a database table?  Or a DOM table?

This topic is locked and can not be replied to.