Reputation: 117
I generated a scaffold for Studio. Now am linking from Products view
<%= button_to 'Customize', new_studio_path %>
resources :studios is placed in routes.rb
I am still getting No route matches [POST] "/studios/new"
If someone could help me figure this out I would appreciate it tons.
Here is a gists of the files I am working with for this. https://gist.github.com/JRizzle88/7861628
Upvotes: 0
Views: 74
Reputation: 4417
The rails convention would be to use link_to
which will send a GET request:
<%= link_to 'Customize', new_studio_path %>
Upvotes: 1
Reputation: 44675
Button is sending a POST request, where your server expects a GET request for given url. You need to specify method on a button:
<%= button_to 'Customize', new_studio_path, method: :get %>
Upvotes: 2
Reputation: 51151
Button's default HTTP method is POST, what you need is method GET, so you need to specify this explicitly:
<%= button_to 'Customize', new_studio_path, method: :get %>
Upvotes: 2