Made Rails presence check more defensive

It will be safer to check for the presence of pair Rails and VERSION constants, so newrelic gem will not crash applications which have only a Rails module, not Rails itself.