Posted
16 July 2009 @ 4pm

Tagged
, , ,

Share and Enjoy
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • LinkedIn
  • Digg
  • Twitter
  • Reddit
  • MySpace
  • Technorati
  • StumbleUpon
  • Tumblr
  • Slashdot
  • email
  • Print

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.


blog comments powered by Disqus
deploy:web:disable and Dreamhost Rails 2.3.1+, Passenger, and Rack 1.0