开发者

Ignore rake task in production

开发者 https://www.devze.com 2023-01-26 01:59 出处:网络
I have a 开发者_StackOverflow中文版rake task to populate my db which depends on faker, so at the top there\'s:

I have a 开发者_StackOverflow中文版rake task to populate my db which depends on faker, so at the top there's:

require 'faker'

The problem is I don't install faker in production so all rake commands (like db:migrate) fail on that require line, saying faker is missing.

Obviously I could install faker in production to get around this, but I don't need it there. So what's the right solution -- can I somehow ignore certain rake tasks in production?


Move the require statement into the task which actually needs it.


I suppose you could just do require 'faker' unless RAILS_ENV='production'

0

精彩评论

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