Reputation: 899
I wonder where those controller default actions defined. Even though I do not write the index action, the index view could be render! I used to read rails source code, but I can get where the method declares. I guess the actions is known by rails by the routes.rb . Anyone knows where I can find them in rails source code.
Upvotes: 0
Views: 162
Reputation: 1077
You could see in rails/actionpack/lib/action_controller/metal/implicit_render.rb
def method_for_action(action_name)
super || if template_exists?(action_name.to_s, _prefixes)
"default_render"
end
end
Rails will call default render when there is template even without you define action name.
Upvotes: 1