What is the correct way to manage conditional flow in a gem based on Rails version?
Rails 4 changes some things so I need to conditionally flow based on Rails major version being 4 vs. 3 or prior.
The closest I've come is:
if Rails.version.split(".").first.to_i < 4
# Do the Rails 4 thing
else
# Do it the old way
end
"4.0.1".to_i
is4
. You don't need to split if you don't care about anything after the decimal place.