tpope / vim-rails

rails.vim: Ruby on Rails power tools
http://www.vim.org/scripts/script.php?script_id=1567
4.09k stars 381 forks source link

Default controller projection to ApplicationController #570

Closed m1foley closed 3 years ago

m1foley commented 3 years ago

Similar to how :Einitializer with no arguments defaults to the routes file, :Econtroller with no arguments should default to ApplicationController. This seems like a reasonable default because AFAICT all Rails applications are generated with this as the default top-level controller (even with the --api option).

This PR has the side effect of creating application_controller.rb if it doesn't exist. That seems unexpected to me, but I couldn't figure out an implementation that doesn't do that.

tpope commented 3 years ago

There's already a default, based on the file you are currently editing.