I’m having an issue with Rails, I get the following error:
No route matches {:action=>"publish", :controller=>"businesses"}
The offending code:
<div id="searchDatesDiv" style="margin: 0 auto;">
<%= form_tag(publish_business_path, :method => :post) do %>
<%= submit_tag("Publish") %>
<% end %>
</div>
routes.rb:
resources :businesses do
member do
post 'publish'
end
end
rake routes:
registration GET /registrations/:id(.:format) registrations#show
publish_business POST /businesses/:id/publish(.:format) businesses#publish
businesses GET /businesses(.:format) businesses#index
POST /businesses(.:format) businesses#create
I can see the path defined in rake routes. Why am I getting this error? The form is also a POST method. Any help would be great! I’ve tried looking at similar questions on SO but haven’t found one that works in my case :(.
Your business publish path requires an id parameter that you are not giving it. Pass the business object to the path helper thusly: