How can I detect that code is running outside the main rails app?
For example in a console, or in a rake task, or as part of a scheduler action, etc.
I understand that there are specific ways to do this for each case (i.e. check Rails::Console etc, but I am looking for a general way to this that will work for all cases.
To clarify a bit further. By "main rails app" I mean the "instance" of rails that is responding to http requests.