Passing params through destroy

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

On Mar 4, 2010, at 4:21 PM, Dudebot wrote:

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…

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 [email protected] wrote:

you sure?’, :method => :delete %>
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected][email protected]
.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.


Thanks:
Rajeev sharma

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