Added additional protection for the ID of Rails environment, used in les...

...s than ideal sinatra environments for instance

This was required for our usage in a sinatra app uses db_charmer.

While check on Rails should have suffice, it didn't because of the app complexity and dependent gem.
For instance, the chrome extension https://rubygems.org/gems/meta_request/versions/0.2.0 is one such case..