-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Gem::Version properly #1024
Conversation
That seems weird. Comparing string sizes like this seems incorrect to me. For example:
|
That's an excellent point, though I have no idea what to_f did with that. I didn't even consider that case, though it's obvious now. How is Gem::Version intended to be compared? |
Here's even more weird example: '3.1.2' > '3.1.10' # => true What about <=>: |
@abotalov if Rails previously returned something other than a |
@jnicklas What about: if Rails.version.is_a?(String)
Gem::Version.new(Rails.version) >= Gem::Version.new(3.0)
else
Rails.version >= Gem::Version.new(3.0)
end |
I'm not even sure what it was before, was it really a string? |
1.9.3p286 :015 > Rails.version
=> "3.2.11" |
How about: Gem::Version.new(Rails.version) >= Gem::Version.new(3) This is compatible with |
78e3a48
Due to rails/rails#8501, we can no longer case the Rails version to a float. This version should hopefully work on both Rails 4 master and on Rails 3.
I cherry picked this onto 2.0_stable and released it as 2.0.3 together with another tweak. A simple |
I haven't tested this with rails < 4-master, but this fixes breakage where Rails.version now returns a Gem::Version and these comparisons fail there. This is the offending commit afaict: rails/rails@c07e151