8

The opposite of this question: Run initializer only for Rake tasks

Is it possible to exclude an initializer during rake tasks?

Thanks.

Community
  • 1
  • 1
Finbarr
  • 31,350
  • 13
  • 63
  • 94

1 Answers1

2

You could wrap your initializer in a block like this:

unless ( File.basename($0) == 'rake')
   # Initializer code
end

Straight from this answer: https://stackoverflow.com/a/24159563/1867481

Community
  • 1
  • 1