I created new model via scaffold and I added new action there - quick. To routes.rb I added get "photos开发者_开发问答/quick" and created the file qucik.html.erb (and it's in the right view-directory).
If I will set to browser localhost:3000/photos/quick, I will get the error above. In my controller it looks very simple:
def quick
end
And also in the view:
<div>this is template for quick action</div>
How is possible to get that error message? Why is run show action?
routes.rb:
FirstApp::Application.routes.draw do
resources :photos
get "photos/quick"
root :to => "photos#index"
end
Change routes to use collection
and fix the code structure to use the blocks properly:
FirstApp::Application.routes.draw do
resources :photos do
collection do
get "quick"
end
end
root :to => "photos#index"
end
See some documentation here about such routes
精彩评论