I noticed that an index view is routed correctly even if there isn’t a controller method index.
As an example, the routes.rb has this route
AppName::Application.routes.draw do
get 'about' => "about#index"
end
My controller looks like this with no index method (def index end)
class AboutController < ApplicationController
end
and I have a view called index.html.erb in the views/about folder
What’s happening here? Is this a case of rails magic where they automatically show the view even if there is no controller method? I couldn’t find any documentation on this…
If you have the view file, it’ll go ahead and render that implicitly, as documented here
See also, this SO thread on how Rails renders your view files and controller actions.