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:- <div id=''dellink_approve'' style="float:left;margin-top:0px;"> <%= 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'');Element.show(''spinner_approve'');", :loaded => "Element.hide(''spinner_approve'');Element.show(''dellink_approve'');", :html => {:class => ''searchButton bulkApproveButton''} %> </div> 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 Regards Chandrika -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
radhames brito
2011-Mar-18 23:04 UTC
Re: Passing primary key into the controller from view.
For the restful way first you have to properly add the non restful action to the routes member do POST channel_invites_approve end and then pass the value since this will create a helper like this channel_invites_approve_path() and you can pass the value like this channel_invites_approve_path(@invitations) but i would do all this in the create action of a controller. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.