hardcoded eager_load=false for rake tasks

Hi Guys,

Is there a reason why the eager_load option is hardcoded to false for the rake tasks?


I am in a situation when I need to turn that on for an import rake tasks which would take ages without multithreading but with multiple threads my code has race conditions with eager_load=false. In the moment my task is just not depending on the environment task rather I load the environment in that task. It all works well but the fact this value is hardcoded makes me think maybe there is something I am not aware of and it can cause problems later.

So my question is: Is that option false just for performance reasons or is there something else I am not aware of? Is it safe to turn eager_load on for a rake task?(I guess this is depending on what that task does).

I appreciate any help and advise!


Hi Greg,

Here is the related ticket for that change: https://github.com/rails/rails/issues/11381

Thanks, but this doesn’t answer my question at all :). I saw where was it added and I guess I know why it is a better to keep this false by default. My question is if I have a set of rake tasks where I use multiple-threads so I have to turn eager_load on can there be any surprise. I don’t think there can be just wanted to hear the opinion of someone from the core team.