views:

24

answers:

1

Hi

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.

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

+1  A: 

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