Ruby on Rails Sunday, March 30, 2014



On Saturday, March 29, 2014 1:02:45 PM UTC-4, Me wrote:
I have a rails 4 app that has a link_to with a post method but I keep getting:

No route matches [GET] "/payments/136330"


<%= link_to("Buy Now", buy_path(list_item), :method => :post) %>

Ideas??

a little difficult without a full log, but a strong, educated guess would be that there's a javascript problem.  Links always generate a GET action.  When you use :method => :post, there's javascript in the rails javascript file that detects it, re-writes the link as a form, and submits it as a post.  If that javascript is missing, or if there's a javascript error that prevents it from executing, you'll get the message you're getting above.

@mike2r

--
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/70d6b54d-d843-4d46-a7a1-3381774cb5ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment