开发者

Passing a default parameters for "rails generate" command

开发者 https://www.devze.com 2023-01-26 04:34 出处:网络
I\'d like to pass the parameters in开发者_开发技巧 \"rails generate\" commands by default. For example, I\'d like to always have \"-=rspec\" to generate rspec files associate with the model. Also I\'

I'd like to pass the parameters in开发者_开发技巧 "rails generate" commands by default.

For example, I'd like to always have "-=rspec" to generate rspec files associate with the model. Also I'd like to avoid generating fixture files.

In generating controllers, I don't want a helper generated.

I thought there'd be a way to specify the default paramers somewhere in the code, probably in "config" or "script" directories.


You need define what kind of generator you want in your application.rb like that :

 config.generators do |g|
   g.template_engine :haml
   g.test_framework  :rspec
 end
0

精彩评论

暂无评论...
验证码 换一张
取 消