Rails 怎么配置 rails 命令的参数

zealinux · July 05, 2013 · Last by kyktommy replied at July 05, 2013 · 2259 hits

每次输入 rails g controller/model xx 都会加上 --no-test-framework, --no-helper,和--no-assets.

我不想这么麻烦, 是不是可以将三个参数配置到脚本里。或者做个 alias rails。 怎么简化

See Railscast #216 generators in rails 3

In config/application.rb, add

config.generators do |g|
  g.test_framework false
end

It override the default generate config, you can see what is default using rails g scaffold --help

You need to Sign in before reply, if you don't have an account, please Sign up first.