Make gem support Rails 3.x

Use Rails.{root|env} instead of global statics, which are deprecated.