蕲春人 - 软件开发

简单就是美.

Customizing Rails Generator Templates

Rails framework and twitter bootstrap are good for your startup project, build-in generators generate source code by its way. It is a good starting point.

But I often have to change default generted source code:

  • Add encoding: utf-8 into ruby file header, for Ruby 1.9.2 encoding.
  • Change scaffold view files to apply bootstrap css.
  • Other things you want to override default templates.

Rails provides the mechanism to custom generator behavior.

I have already got it, and source code is on github, follow README for usage.

Comments