Ruby on Rails
Monday, March 31, 2014
Check if jquery-ujs is being loaded properly. I'd wager, your "Are you sure?" confirmation isn't even popping up.
On Mon, Mar 31, 2014 at 9:42 PM, Claudiu Clau <claudiu.garba@gmail.com> wrote:
I think here is the error: <td><%= link_to 'Destroy', post, method: :delete, data: {confirm: 'Are you sure?'} %></td>= link_to 'Destroy', post_path(post), bla bla bla
On Monday, March 31, 2014 6:02:09 PM UTC+2, Peter Heylin wrote:Hi All,I am new to RoR and I am writing a small blog application. I have added a Destroy / Delete link to the post index, but when I click this delete link the show action is fired. The log seems to confirm this:Started GET "/posts/2" for xxx.xxx.xxx.xxx at 2014-03-31 15:51:03 +0000Processing by PostsController#show as HTMLParameters: {"id"=>"2"}Post Load (0.1ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" = ? LIMIT 1 [["id", "2"]]Comment Load (0.1ms) SELECT "comments".* FROM "comments" WHERE "comments"."post_id" = ? [["post_id", 2]]Rendered posts/show.html.erb within layouts/application (9.0ms)Completed 200 OK in 120ms (Views: 117.3ms | ActiveRecord: 0.2ms)My destroy method in the controller is:def destroy@post = Post.find(params[:id])@post.destroyredirect_to posts_pathendThe code in the index view is:<td><%= link_to 'Destroy', post, method: :delete, data: {confirm: 'Are you sure?'} %></td>Would anyone have any idea what I might be missing here?Any help appreciatedPeterTo view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/e765b1b0-b7d5-4038-92c1-e6f6c0122c59%40googlegroups.com.--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
Regards,
Abdulsattar Mohammed You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAGqGsFTgqyUDFfbNOHNpQysf7W7KRFPW2T%2BFpk8%3DTpH%3DWhLU6g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment