Rails running in script/console?
If you ever wanted to know if your application is running normally or in console mode, here’s the trick:
def in_console? Object.const_defined?(:IRB) end
This would break if you require’d IRB in your Rails application normally, though I can’t possibly imagine why you would.





