Suppose I run
rails new proj1
I can do
rails generate abc def controller
and this creates, among other things. \ app \ views \ abc \ def.html.erb
And I can edit config.rb to say
get '/', to: 'abc#def'
or
root 'abc#def'
And this will load this template def.html.erb
when I go tohttp://127.0.0.1:3000/
But I wonder if I can do this without creating this new controller. I am wondering if I can only go to the template using the application controller.
So, for example, I can edit .\app\controllers\application_controller.rb
and add
def a
end
then the application controller behaves like other controllers and tries to display the corresponding .html.erb file, for example. action 'a' will try to display a.html.erb? If so, I cannot find where I should place the a.html.erb file?
, , , rails generate controller blah a b c
.
. , .