The problem here is that when I click on the button “Read More” (on the
index default of my application on Clinica) I get the error “No route
matches [POST] “/consultas/new””. I can’t understand what is the mistake
I’m doing.
Does anyone know what is happening?
Any help is welcome!
Thank you,
Rita F.
On Friday, August 23, 2013 12:25:29 PM UTC+1, Rita F. wrote:
on the routes.rb I have:
The problem here is that when I click on the button “Read More” (on the
index default of my application on Clinica) I get the error “No route
matches [POST] “/consultas/new””. I can’t understand what is the mistake
I’m doing.
button_to does a post request by default. if you add a :method => :get
option to it then it should work
The issue here is that button_to automatically generates a form with a
submit button. The default method for forms in “POST” (which is why
you’re seeing that in the routing error below.
Take a look at the page source for this view to see what is being
generated.
The docs for button_to are at:
You can change the method used by passing in the :method => :get option
on that call. The other thing you might look at is using link_to instead
of button_to, and making it look like a button with css classes. (It
looks like you’re using twitter bootstrap, which does this pretty
easily.)
Hi tamouse,
I tried it with button_to with the ‘tag’ :method => :get and I got no
error!
Then I decided to use link_to and I got success too!
Thank you veryyyy much
Sexta-feira, 23 de Agosto de 2013 19:17:40 UTC+1, tamouse escreveu: