开发者

How to know if model is used from Rake?

In a model, I include a module used by a Rake task.

I would like to do this include only for rake and not for Rails.开发者_如何学Go

I didn't find any method to know if the model is used by Rails or Rake.

I use Rails3.0.beta3.

If you have any idea i would be glad to hear them :)

Thanks


You can solve your problem with defined variable.

You define a variable into your rake task

RAKE_TASK = true

And in your model you test it with defined?

if defined? RAKE_TASK
def your_method

end
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜