Passing primary key into the controller from view

Hello All
I have an invitations page where all invitations for channels sent are
listed with checkboxes.An Accept and Reject button is present at the
end of the list.
The logged in user can accept or reject the invitations by selecting
the checkboxes.

In my invitations.html.erb(which is my view),I have an instance
variable @invitations which holds the rows of the
invitation_workflow_table (each row corresponding to a channel on
invitations.html.erb.);invitation_workflow_id being the primary key of
that table.

My view code is as follows:-

<%= submit_to_remote 'Approve', '', :url => {:action => 'channel_invites_approve'}, :condition => "checkBoxCheckedOrNot()", :update => 'msg_div', :success => visual_effect(:highlight, "msg_div",:startcolor =>'#FFFFFF',:duration =>APP_CONSTANTS['message_time_in_second']), :complete => "setTimeout('othersRequest(#{@page.to_i},#{@invitations.size})',#{APP_CONSTANTS['set_timeout_for_visual_effect'].to_i});", :loading => "disableCheckBox();Element.hide('dellink_approve');'spinner_approve');", :loaded => "Element.hide('spinner_approve');'dellink_approve');", :html => {:class => 'searchButton bulkApproveButton'} %>

I want to pass this primary key to the controller as an id at the line
[:url => {:action => ‘channel_invites_approve’},]

How can that be done?

Thanks in Advance


For the restful way first you have to properly add the non restful
action to
the routes

member do
POST channel_invites_approve

and then pass the value since this will create a helper like this


and you can pass the value like this


but i would do all this in the create action of a controller.

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