I''m stumped. My link_to that is supposed to generate a DELETE is generating a GET. And I don''t understand why. Can anyone suggest what I should be looking for to debug this? (The one thing I can think of is that I''m including jquery.js and perhaps messed up the js?) Here''s the partial with the link_to: === file: app/views/premises/_premise.html.erb ... <%= link_to "delete", premise, :method => :delete, :confirm => "Positive?", :title => "Delete #{premise.address}" %> ... and the generated log entry: Started GET "/premises/1" for 127.0.0.1 at 2011-01-26 13:33:19 -0800 Processing by PremisesController#show as HTML Parameters: {"id"=>"1"} Other details: The partial is called from: === file: app/views/premises/index.html.erb ... <%= render :partial => "premise", :collection => @premises %> Routing is restful: === file: config/routes.rb Demo::Application.routes.draw do ... resources :premises ... -- Posted via http://www.ruby-forum.com/. -- 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.
Fearless Fool wrote in post #977722:> I''m stumped. My link_to that is supposed to generate a DELETE is > generating a GET. And I don''t understand why.Browsers generally only support GET and POST. When Rails generates a DELETE link, what it''s actually doing is generating a GET link with _method=delete. Rails parses the _method parameter and treats it exactly as if it were a real DELETE request. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- 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.
Marnen Laibow-Koser wrote in post #977726:> Browsers generally only support GET and POST. When Rails generates a > DELETE link, what it''s actually doing is generating a GET link with > _method=delete. Rails parses the _method parameter and treats it > exactly as if it were a real DELETE request.Hi Marnen. I understand your explanation. But my PremisesController#show method is getting called, not PremisesController#destroy method. At the time the show() method is called, params looks like: params={"action"=>"show", "controller"=>"premises", "id"=>"2"} So where did things go astray? (More constructively, where should I look / how would you debug this?) -- Posted via http://www.ruby-forum.com/. -- 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.
How do you set route to the delete action? The other day I met same problem, I modified link_to''s second argument(after first "name" argument) to application path and then worked fine at the time. Might fit into your case, maybe. On 1/27/11, Fearless Fool <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Marnen Laibow-Koser wrote in post #977726: >> Browsers generally only support GET and POST. When Rails generates a >> DELETE link, what it''s actually doing is generating a GET link with >> _method=delete. Rails parses the _method parameter and treats it >> exactly as if it were a real DELETE request. > > Hi Marnen. I understand your explanation. But my > PremisesController#show method is getting called, not > PremisesController#destroy method. At the time the show() method is > called, params looks like: > > params={"action"=>"show", "controller"=>"premises", "id"=>"2"} > > So where did things go astray? (More constructively, where should I > look / how would you debug this?) > > -- > Posted via http://www.ruby-forum.com/. > > -- > 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. > >-- 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.
Dai O. wrote in post #977736:> How do you set route to the delete action?I''m just using the premise object as the second arg to link_to: <%= link_to "delete", premise, :method => :delete, :confirm => "Positive?", :title => "Delete #{premise.address}" %> The generated HTML is (for example): <a href="/premises/2" data-confirm="Positive?" data-method="delete" rel="nofollow" title="Delete 123 Chestnut Street">delete</a> That looks basically right to me, so I''m still stumped. -- Posted via http://www.ruby-forum.com/. -- 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.
Do you have something like this in routes.rb: map.resources :premises On Jan 26, 5:36 pm, Dai Odahara <dai.odah...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> How do you set route to the delete action?-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Fearless Fool wrote in post #977742:> Dai O. wrote in post #977736: >> How do you set route to the delete action? > > I''m just using the premise object as the second arg to link_to: > > <%= link_to "delete", > premise, > :method => :delete, > :confirm => "Positive?", > :title => "Delete #{premise.address}" %>...which can''t possibly work as you''d like. Rails is correctly generating the path to the show action from the object you gave it.> > The generated HTML is (for example): > > <a href="/premises/2" > data-confirm="Positive?" > data-method="delete" > rel="nofollow" > title="Delete 123 Chestnut Street">delete</a> > > That looks basically right to me, so I''m still stumped.How can that look right to you? There''s nothing telling Rails that you want DELETE or the destroy action. (The data-* attributes are client-side, and Rails will never see them.) What you need is something like destroy_premise_path(premise) for the URL in link_to -- check rake routes for the exact name. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org Sent from my iPhone -- Posted via http://www.ruby-forum.com/. -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Marnen Laibow-Koser wrote in post #977756:>> The generated HTML is (for example): >> >> <a href="/premises/2" >> data-confirm="Positive?" >> data-method="delete" >> rel="nofollow" >> title="Delete 123 Chestnut Street">delete</a> >> >> That looks basically right to me, so I''m still stumped. > > How can that look right to you? There''s nothing telling Rails that you > want DELETE or the destroy action. (The data-* attributes are > client-side, and Rails will never see them.)Do you mean that the :method => :delete option has no effect on the server? The documentation suggests something different.> What you need is something like destroy_premise_path(premise) for the > URL in link_to -- check rake routes for the exact name.I thought the same thing, but rake routes gives me: premises GET /premises(.:format) {:action=>"index", :controller=>"premises"} POST /premises(.:format) {:action=>"create", :controller=>"premises"} new_premise GET /premises/new(.:format) {:action=>"new", :controller=>"premises"} edit_premise GET /premises/:id/edit(.:format) {:action=>"edit", :controller=>"premises"} premise GET /premises/:id(.:format) {:action=>"show", :controller=>"premises"} PUT /premises/:id(.:format) {:action=>"update", :controller=>"premises"} DELETE /premises/:id(.:format) {:action=>"destroy", :controller=>"premises"} ... which, if I read this correctly, means that the delete path is still just called "premise_path" -- the same as GET and PUT, but using a :destroy method instead. So it still comes back to : how do I get link_to to generate a :destroy action? I''m sure it''s and obvious and stupid error on my part. (The perplexing things is that I''ve done this lots of times before...) -- Posted via http://www.ruby-forum.com/. -- 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 Jan 26, 10:50 pm, Fearless Fool <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> > <a href="/premises/2" > data-confirm="Positive?" > data-method="delete" > rel="nofollow" > title="Delete 123 Chestnut Street">delete</a> > > That looks basically right to me, so I''m still stumped. >Have you got the rails js loaded that detects those attributes and actually does something with them? Fred -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung wrote in post #977813:> Have you got the rails js loaded that detects those attributes and > actually does something with them?@Fred: As I alluded to in the OP, I''m suspicious that I may have messed up the default Rails JS when I included JQuery. My app/views/layouts/application.html.erb file contains: <head> ... <%= javascript_include_tag :defaults %> </head> ... and the resulting HTML looks like this: <head> ... <script src="/javascripts/jquery.min.js?1295771209" type="text/javascript"></script> <script src="/javascripts/rails.js?1295934227" type="text/javascript"></script> <script src="/javascripts/application.js?1296109843" type="text/javascript"></script> </head> Is that what you''d expect it to be? - ff -- Posted via http://www.ruby-forum.com/. -- 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 27 Jan 2011, at 08:06, Fearless Fool <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Frederick Cheung wrote in post #977813: >> Have you got the rails js loaded that detects those attributes and >> actually does something with them? > > @Fred: As I alluded to in the OP, I''m suspicious that I may have messed > up the default Rails JS when I included JQuery. My > app/views/layouts/application.html.erb file contains: > > <head> > ... > <%= javascript_include_tag :defaults %> > </head> > > ... and the resulting HTML looks like this: > > <head> > ... > <script src="/javascripts/jquery.min.js?1295771209" > type="text/javascript"></script> > <script src="/javascripts/rails.js?1295934227" > type="text/javascript"></script> > <script src="/javascripts/application.js?1296109843" > type="text/javascript"></script> > </head> > > Is that what you''d expect it to be?The default rails.js that ships with Rails 3 is designed to work with Prototype; you should replace it with one written to work on jQuery, if you haven''t already: https://github.com/rails/jquery-ujs Chris -- 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.
Chris Mear wrote in post #977826:> The default rails.js that ships with Rails 3 is designed to work with > Prototype; you should replace it with one written to work on jQuery, if > you haven''t already: > > https://github.com/rails/jquery-ujs > > ChrisGive that man a cigar! Evidently I''d installed the gem but missed the all important: $ rails generate jquery:install step. All better now. [Summary for anyone who comes here via google] If you''re using jQuery, and if you notice that ''link_to obj, :method=> :delete'' is failing to trigger your controller''s destroy() method, make sure that: (a) you have the correct routes set up -- do a rake routes to make sure (b) you''ve installed the jQuery adaptor gem (and done a ''bundle install'') (c) you''ve called ''rails generate jquery:install'' [/Summary] Thanks, all. - ff -- Posted via http://www.ruby-forum.com/. -- 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.
I''m using this successfully (in a Rails 2.3.5 app): link_to("Delete Post", post_path(@post), :confirm => ''Are you sure?'', :method => :delete) To my knowledge there is no such thing as a delete_XYZ_path. Check your logs to see if DELETE is really received on the top level. For debugging purposed try using curl: curl "localhost:3000/premises/ 123" -X DELETE Hope this helps! Simon On Jan 27, 2:32 am, Fearless Fool <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Marnen Laibow-Koser wrote in post #977756: > > >> The generated HTML is (for example): > > >> <a href="/premises/2" > >> data-confirm="Positive?" > >> data-method="delete" > >> rel="nofollow" > >> title="Delete 123 Chestnut Street">delete</a> > > >> That looks basically right to me, so I''m still stumped. > > > How can that look right to you? There''s nothing telling Rails that you > > want DELETE or the destroy action. (The data-* attributes are > > client-side, and Rails will never see them.) > > Do you mean that the :method => :delete option has no effect on the > server? The documentation suggests something different. > > > What you need is something like destroy_premise_path(premise) for the > > URL in link_to -- check rake routes for the exact name. > > I thought the same thing, but rake routes gives me: > > premises GET /premises(.:format) {:action=>"index", > :controller=>"premises"} > POST /premises(.:format) {:action=>"create", > :controller=>"premises"} > new_premise GET /premises/new(.:format) {:action=>"new", > :controller=>"premises"} > edit_premise GET /premises/:id/edit(.:format) {:action=>"edit", > :controller=>"premises"} > premise GET /premises/:id(.:format) {:action=>"show", > :controller=>"premises"} > PUT /premises/:id(.:format) {:action=>"update", > :controller=>"premises"} > DELETE /premises/:id(.:format) {:action=>"destroy", > :controller=>"premises"} > > ... which, if I read this correctly, means that the delete path is still > just called "premise_path" -- the same as GET and PUT, but using a > :destroy method instead. > > So it still comes back to : how do I get link_to to generate a :destroy > action? I''m sure it''s and obvious and stupid error on my part. (The > perplexing things is that I''ve done this lots of times before...) > > -- > Posted viahttp://www.ruby-forum.com/.-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung wrote in post #977813:> On Jan 26, 10:50pm, Fearless Fool <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > >> >> <a href="/premises/2" >> data-confirm="Positive?" >> data-method="delete" >> rel="nofollow" >> title="Delete 123 Chestnut Street">delete</a> >> >> That looks basically right to me, so I''m still stumped. >> > > Have you got the rails js loaded that detects those attributes and > actually does something with them?I rarely use delete links, so I didn''t realize that it took JavaScript to make one. This seems dysfunctional, and reinforces my belief that having a link be anything other than GET represents a design problem. Hmm. My instinct is to suggest defining a GET destroy action. OTOH, that''s not idempotent. Aaugh!> > FredBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org Sent from my iPhone -- Posted via http://www.ruby-forum.com/. -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Marnen Laibow-Koser wrote in post #977875:> I rarely use delete links...That''s interesting!> My instinct is to suggest defining a GET destroy action. OTOH, that''s > not idempotent. Aaugh!Browsers only generate GETs and POSTs, so any DELETE action needs to be simulated somehow. And as you point out, GETs (by contract) must be idempotent. Which leave POST messages. So I''m curious: how do you delete things? Write semi-custom forms that POST something? -- Posted via http://www.ruby-forum.com/. -- 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.
Fearless Fool wrote in post #977888:> Marnen Laibow-Koser wrote in post #977875: >> I rarely use delete links... > > That''s interesting! > >> My instinct is to suggest defining a GET destroy action. OTOH, that''s >> not idempotent. Aaugh! > > Browsers only generate GETs and POSTs, so any DELETE action needs to be > simulated somehow. And as you point out, GETs (by contract) must be > idempotent. Which leave POST messages. > > So I''m curious: how do you delete things? Write semi-custom forms that > POST something?Usually, I don''t delete things from the Web interface. I generally hide them (like acts_as_paranoid), use ActiveScaffold, or require deletion from the console. That''s not suitable for every application, obviously. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org Sent from my iPhone -- Posted via http://www.ruby-forum.com/. -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi, I am new to rails and was very pleased to find this thread. After reinstalling ruby with rvm ( ruby-1.9.2-p0 [ x86_64 ]) installing rails 3.0.3 installing gem ''jquery-rails'' rails generate jquery:install rails generate scaffold locality name:string type:string parent_id:string There is still the same problem: method delete gets routed to action show. Definig my own delete route may be a workaround. Having scaffolding which does not work looks not right. Ernst On Jan 27, 8:44 pm, Fearless Fool <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Chris Mear wrote in post #977826: > > > The default rails.js that ships with Rails 3 is designed to work with > > Prototype; you should replace it with one written to work on jQuery, if > > you haven''t already: > > >https://github.com/rails/jquery-ujs > > > Chris > > Give that man a cigar! > > Evidently I''d installed the gem but missed the all important: > > $ rails generate jquery:install > > step. All better now. > > [Summary for anyone who comes here via google] > > If you''re using jQuery, and if you notice that ''link_toobj, :method=> > :delete'' is failing to trigger your controller''s destroy()method, make > sure that: > > (a) you have the correct routes set up -- do a rake routes to make sure > (b) you''ve installed the jQuery adaptor gem (and done a ''bundle > install'') > (c) you''ve called ''rails generate jquery:install'' > > [/Summary] > > Thanks, all. > > - ff > > -- > Posted viahttp://www.ruby-forum.com/.-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi I am a newbie, So I followed the suggestions by Chris Mear and Fearless Fool but still delete gets routed to show! However this works: curl "http://10.0.1.33:3000/localities/1" -X DELETE Resoure locality was created with rails generate scaffold ... Thanks Ernst -- 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.
What about this workaround: Define an additional route match ''localities/:id/delete'' => ''localities#destroy'', :as => :delete_locality Thanks Ernst -- 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.
Can you double-check you did everything listed here: https://github.com/rails/jquery-ujs Also, have a look at your HTML source if all js files are included (and in the correct order). Simon On Jan 31, 3:38 am, eka <forer...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > I am new to rails and was very pleased to find this thread. After > reinstalling ruby with > rvm ( ruby-1.9.2-p0 [ x86_64 ]) > installing rails 3.0.3 > installing gem ''jquery-rails'' > rails generate jquery:install > rails generate scaffold locality name:string type:string > parent_id:string > > There is still the same problem: method delete gets routed to action > show. > > Definig my own delete route may be a workaround. Having scaffolding > which does not work looks not right. > > Ernst > > On Jan 27, 8:44 pm, Fearless Fool <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > > > > > > > > > Chris Mear wrote in post #977826: > > > > The default rails.js that ships with Rails 3 is designed to work with > > > Prototype; you should replace it with one written to work on jQuery, if > > > you haven''t already: > > > >https://github.com/rails/jquery-ujs > > > > Chris > > > Give that man a cigar! > > > Evidently I''d installed the gem but missed the all important: > > > $ rails generate jquery:install > > > step. All better now. > > > [Summary for anyone who comes here via google] > > > If you''re using jQuery, and if you notice that ''link_toobj, :method=> > > :delete'' is failing to trigger your controller''s destroy()method, make > > sure that: > > > (a) you have the correct routes set up -- do a rake routes to make sure > > (b) you''ve installed the jQuery adaptor gem (and done a ''bundle > > install'') > > (c) you''ve called ''rails generate jquery:install'' > > > [/Summary] > > > Thanks, all. > > > - ff > > > -- > > Posted viahttp://www.ruby-forum.com/.-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.