fix rails version check

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