I''m having a strange sort of problem. I''d like to pass a param when I''m deleting a record, but can''t seem to do it. I''ve tried all sorts of variants of: def destroy @note = Note.find( params[ :id ] ) @patient = Patient.find( params[ :patient_id ] ) # this is where I''m trying to pass a parameter @note.destroy respond_to do |format| format.html { redirect_to :action => "index", :patient_id => @patient.id } format.xml { head :ok } end end And I''ve tried all sorts of variants of: <%= link_to ''Delete'', note, :patient_id => @patient, :confirm => ''Are you sure?'', :method => :delete %> Which don''t work. Is there any way to pass params through delete? TIA, Craig -- 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.
On Mar 4, 2010, at 4:21 PM, Dudebot wrote:> I''m having a strange sort of problem. I''d like to pass a param when > I''m deleting a record, but can''t seem to do it. > > I''ve tried all sorts of variants of: > > def destroy > @note = Note.find( params[ :id ] ) > @patient = Patient.find( params[ :patient_id ] ) # this is where > I''m trying to pass a parameter > @note.destroy > > respond_to do |format| > format.html { redirect_to :action => "index", :patient_id => > @patient.id } > format.xml { head :ok } > end > end > > And I''ve tried all sorts of variants of: > > <%= link_to ''Delete'', note, :patient_id => @patient, :confirm => ''Are > you sure?'', :method => :delete %> > > Which don''t work. Is there any way to pass params through delete?<%= link_to ''Delete'', note_path(note, :patient_id => @patient.id), :confirm => ''Are you sure?'', :method => :delete %> Assuming ''notes'' is a restful route... -- 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.
def delete @note = Note.find( params[ :id ] ) @patient = Patient.find( params[ :patient_id ] ) # this is where I''m trying to pass a parameter @note.destroy respond_to do |format| format.html { redirect_to :action => "index", :patient_id => @patient.id } format.xml { head :ok } end end Try it Out ok On Fri, Mar 5, 2010 at 5:51 AM, Dudebot <craignied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m having a strange sort of problem. I''d like to pass a param when > I''m deleting a record, but can''t seem to do it. > > I''ve tried all sorts of variants of: > > def destroy > @note = Note.find( params[ :id ] ) > @patient = Patient.find( params[ :patient_id ] ) # this is where > I''m trying to pass a parameter > @note.destroy > > respond_to do |format| > format.html { redirect_to :action => "index", :patient_id => > @patient.id } > format.xml { head :ok } > end > end > > And I''ve tried all sorts of variants of: > > <%= link_to ''Delete'', note, :patient_id => @patient, :confirm => ''Are > you sure?'', :method => :delete %> > > Which don''t work. Is there any way to pass params through delete? > > TIA, > Craig > > > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- Thanks: Rajeev sharma -- 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.