Hello,
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") %>
<br>
<%end%>
<br>
<%= submit_tag "CreateRelation" %>
<%= end_form_tag %>
Controller code:
def save
@relation = Relation.create(params[:relation])
@relation.userid = current_user.id
@relation.save!
redirect_to :action => ''index''
end
--
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
-~----------~----~----~----~------~----~------~--~---