If I want to change the default controller template created by scaffold in Rails it’s dead easy – after Googling around I found I can just put a controller.rb file in lib/templates/rails/controller for the generator to pick up on instead of the default.
I cannot find any explanation of where I can do the same for a model file. I don’t want to build a separate generator, I just want:
> rails generate model foo
to create foo.rb model file based on a model.rb template I make.
Not sure if this is a great idea but you can find the generator code here: https://github.com/rails/rails/blob/master/railties/lib/rails/generators/rails/model/model_generator.rb
According to this post though you should be able to put a template in
lib/templates/rails/modelthough you may need to specify where it is located via a rake task according to this