Inserting multiple rows in the table?


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’

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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs