Thanks, here is the link generated, <a data-method="post"
href="/list_items/136298/buy" rel="nofollow">Buy Now</a>
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:
>
>
> 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 a topic in the
> Google Groups "Ruby on Rails: Talk" group.
> 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
> https://groups.google.com/d/msgid/rubyonrails-talk/70d6b54d-d843-4d46-a7a1-3381774cb5ca%40googlegroups.com<https://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*
--
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 [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/CAKohUFw-oMOEoa92ESoKW39AwBhs56MYjwsZ1hikEzryydeY8Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.