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??
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??
Route, post ‘payments/:list_item_id’, to: ‘payments#buy’, :as => :buy
Please change your name from “Me” to something else. It’s confusing.
Hi,
Can you copy your full routes.rb, I believe you should place the route
at
before the route
“resources :payment”
Regards,
Logan
Sent from mobile device
On 29 Mar 2014 22:34, “Me” [email protected] wrote:
Route, post ‘payments/:list_item_id’, to: ‘payments#buy’, :as => :buy
On Saturday, March 29, 2014 12:02:45 PM UTC-5, 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??
–
You received this message because you are subscribed to the Google G.
“Ruby on Rails: Talk” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/21350ab3-a33d-41cb-9061-e103db36b31b%40googlegroups.com
.
Post your routes.rb file
That is the only route for that controller.
On Sat, Mar 29, 2014 at 12:33 PM, Loganathan S. <
[email protected]> wrote:
No route matches [GET] “/payments/136330”
To unsubscribe from this topic, visit
–
“In matters of style, swim with the current; in matters of principle,
stand like a rock.” Thomas Jefferson
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.
Thanks, here is the link generated, Buy Now
Routes:
resources :users
resources :list_items do
post :buy, :on => :member
end
root ‘list_items#index’
ERB:
<%= link_to(“Buy Now”, buy_list_item_path(list_item), :method => ‘post’)
%>
On Sun, Mar 30, 2014 at 9:58 AM, mike2r [email protected] wrote:
@mike2r
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/70d6b54d-d843-4d46-a7a1-3381774cb5ca%40googlegroups.comhttps://groups.google.com/d/msgid/rubyonrails-talk/70d6b54d-d843-4d46-a7a1-3381774cb5ca%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.
–
“In matters of style, swim with the current; in matters of principle,
stand like a rock.” Thomas Jefferson
On Apr 6, 2014, at 2:29 PM, Chris H. wrote:
ERB:
<%= link_to(“Buy Now”, buy_list_item_path(list_item), :method => ‘post’) %>
Confirm that rails.js is being loaded. Without it, the unobtrusive stuff
doesn’t work.
Walter
On Sunday, April 6, 2014 7:29:56 PM UTC+1, Me wrote:
Thanks, here is the link generated, Buy Now
That’s not the same url as the once mentioned in the error. Is the post
request completing OK and then redirecting to a non-existent url?
Fred
jquery and jquery_ujs are loaded. it is a rails 4 app.
On Sun, Apr 6, 2014 at 3:55 PM, Walter Lee D. [email protected]
wrote:
post :buy, :on => :member
Confirm that rails.js is being loaded. Without it, the unobtrusive stuff
getting:
action. When you use :method => :post, there’s javascript in the railsTo unsubscribe from this topic, visit
To unsubscribe from this group and stop receiving emails from it, send
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/rubyonrails-talk/3kI7VkfKp4Q/unsubscribe
.
To unsubscribe from this group and all its topics, send an email to
[email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
.
For more options, visit https://groups.google.com/d/optout.
–
“In matters of style, swim with the current; in matters of principle,
stand like a rock.” Thomas Jefferson
On Sunday, April 6, 2014 10:20:37 PM UTC+1, Me wrote:
The one I posted was a slightly different one but still gives me the same
error. It does not seem to recognize the link is a 'POST" even though the
actual link on the page is a post.
You’ll send people round in circles if you’re mixing up different urls &
different errors. As others have said, this sounds suspicious like a
javascript error. Check your browser console for javascript errors. You
might also try sticking some (javascript) breakpoints in the rails
ubobtrusive js code, to check what it is doing.
Fred
The one I posted was a slightly different one but still gives me the
same
error. It does not seem to recognize the link is a 'POST" even though
the
actual link on the page is a post.
No route matches [GET] “/list_items/136327/buy”
The action ‘buy’ is in the liat_items_controller.
On Sun, Apr 6, 2014 at 4:16 PM, Frederick C.
<[email protected]
wrote:
[email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/9a744c1b-ef18-4442-a7e1-a55513c4e4eb%40googlegroups.comhttps://groups.google.com/d/msgid/rubyonrails-talk/9a744c1b-ef18-4442-a7e1-a55513c4e4eb%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.
–
“In matters of style, swim with the current; in matters of principle,
stand like a rock.” Thomas Jefferson
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs