I have the following routing:
resources :pages do
resources :logos do
member do
post 'vote'
end
end
end
Then I have a view that is rendered in /pages/:page_id/logos, that looks like this:
<ul>
<% @logos.each do |logo| %>
<li>
<%= image_tag(logo.url) %>
<%= form_for([logo.page, logo], url: {action: "vote"}, :method => :post) do |f| %>
<% end %>
</li>
<% end %>
</ul>
And I keep getting this error:
No route matches {:action=>"vote", :page_id=>"95", :controller=>"logos"}
What am I missing here?
try
form_for [logos.page, logo, :vote], method: :post
or, it may be that the action comes first in the array
[:vote, logo.page, logo]
Pardon that I don't have to look it up again.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.