I have following route explicitly defined in my routes.rb
map.book_preview_v2 '/books/v2/:id', :controller => 'books', :action => 'show_v2'
But, in the logs, I see following message:
2015-09-25 16:49:04 INFO (session: f561ebeab121cd1c8af38e0482f176b8)
method /books/v2/519869.json (user: xxx:669052) params:
{"controller"=>"books", "action"=>"v2", "id"=>"519869",
"format"=>"json"}
ActionController::UnknownAction (No action responded
to v2. Actions: some_method_1, some_method_2,
some_method_3, some_method_4, some_method_5, **show_v2**,
some_method_6, and some_method_7):
Am I missing some convention over configuration thing? Why in the logs I see action as "v2" instead of "show_v2"?
ActionController::UnknownAction (No action responded to v2. Actions: some_method_1, some_method_2, some_method_3, some_method_4, some_method_5, show_v2, some_method_6, and some_method_7):
Why in the logs I see action as "v2" instead of "show_v2"?
As per the Rails 2 default route
map.connect ':controller/:action/:id'
it expects v2
as action
but you defined show_v2
as action
in the route. Changing your route
to below should work
map.connect '/books/show_v2/:id', :controller => 'books', :action => 'show_v2'