蕲春人的博客

About Blog Email GitHub

12 Jan 2012
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.


蕲春人 at 13:49

scribble

About Blog Email GitHub