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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to