Hello, I''m trying to create a link to delete the record of a discount in my database. I have a page that lists them, each one rendered in a partial with a delete link. I''m trying link_to_remote, but it gives me this errors: No method responded to 28 (which is the record id) Here is a link to my code: http://pastie.org/private/s1m8ddsb27fyad8z1rhyg -- 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.
Try adding a :method => :delete to the link. If you''re using default resource routes, that should do the trick (also you don''t need to use :action => ''destroy'', but can instead pass discount_url(discount) as :url. -- niklas On Tue, 2011-03-01 at 07:22 -0800, Anthony wrote:> Hello, I''m trying to create a link to delete the record of a discount > in my database. I have a page that lists them, each one rendered in a > partial with a delete link. I''m trying link_to_remote, but it gives me > this errors: > > No method responded to 28 (which is the record id) > > Here is a link to my code: > > http://pastie.org/private/s1m8ddsb27fyad8z1rhyg >
Are you on Rails3 (can''t access pastie from mobile)? <%= link_to ''destroy'', product, :confirm => ''Are you sure?'', :method => :delete, :remote => :true %> -- 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.