I have a default scope set in my model. However, when I call a particular model function from my rake task, I don't want the scope to be in effect. So, when my model is loaded, how can I tell if it was loaded within a rake task or not.
+3
A:
The model should never know something like this. If you want your rake task to access your model without the default_scope kicking in, you should look at the with_exclusive_scope method.
See this blog post for an example.
jdl
2009-08-01 22:56:59