check major rails version directly

In Rails 4, Rails.version returns an instance of Gem::Version.
Instead, we can check the major rails version directly.