The Ruby mixin module I'm writing would be useful for both vanilla Ruby and Rails. What's the best practice for determining at run-time whether Rails is loaded? Is it possible to get the version number as well?
In script/console
for a Rails 2.3.4 project ENV.has_key?("RAILS_ENV")
is true and it's false in my Ruby 1.8.7 interpreter. Is there a more reliable way to tell for all versions of Rails or is this pretty safe?
As for getting the Rails version in the current process, I'm at a loss.