What happened to Rails::Version::STRING in Rails 1.0.0?


#1

Hello,

Maybe it’s a silly question, but I cannot find anything in Rails
changelog or google it out.
There is a Rails::Version module (since version 0.14.something) that
gives me a version number of Rails, similarily to Rails::Info module.
Apparently in Rails version 1.0 (or maybe sooner) the name of the
module was changed from ‘Version’ to ‘VERSION’ which breaks my
debugging template. Is there any reason for this change?
Of course I understand that there’s no need to look behind 1.0 and
bother to keep the compatibility with anything older than 1.0, but
I’d like to widen my Ruby and Rails knowledge.

In 0.14.3 it looks like this:

module Rails
  module Version #:nodoc:
    MAJOR = 0
    MINOR = 14
    TINY  = 3

    STRING = [MAJOR, MINOR, TINY].join('.')
  end
end

and in 1.0.0 it looks like this:

module Rails
  module VERSION #:nodoc:
    MAJOR = 1
    MINOR = 0
    TINY  = 0

    STRING = [MAJOR, MINOR, TINY].join('.')
  end
end

Rafa³ Komorowski
removed_email_address@domain.invalid
GG: 4083718
http://homepage.mac.com/komor/iblog/


#2

On Jan 1, 2006, at 6:03 PM, RafaÅ? Komorowski wrote:

Hello,

Maybe it’s a silly question, but I cannot find anything in Rails
changelog or google it out.
There is a Rails::Version module (since version 0.14.something)
that gives me a version number of Rails, similarily to Rails::Info
module.
Apparently in Rails version 1.0 (or maybe sooner) the name of the
module was changed from ‘Version’ to ‘VERSION’ which breaks my
debugging template. Is there any reason for this change?

Yup, there’s a reason. The reason is that having Rails::Version
caused conflicts with models named Version (because of the way the
auto-loading code works). Rather than rewrite the auto-loading code
(which works well enough otherwise), the quick-n-dirty solution was
to just rename the Rails::Version module to Rails::VERSION.

This issue will be revisited in later Rails releases, though, so
please don’t think this was an attempt to just sweep it under the rug.

  • Jamis

#3

On 02/01/2006, at 03:55, Jamis B. wrote:

Yup, there’s a reason. The reason is that having Rails::Version
caused conflicts with models named Version (because of the way the
auto-loading code works).

Thanks for the info.

This issue will be revisited in later Rails releases, though, so
please don’t think this was an attempt to just sweep it under the rug.

I see :slight_smile:
I hope this will be unchangeable behaviour, once set in first final
release (that is 1.0). I’m pretty sure you understand (better than
me) that version-checking is a sensitive matter, since it’s the way
to make sure my application will behave properly or can be run in the
particular environment at all. For now I can just forget about
anything older that v1.0 (but not everyone can, right?) and use the
new syntax Rails::VERSION. If this breaks in next releases, then the
whole idea of version checking is broken.

Anyway, thanks for the info, thanks for the Rails :slight_smile: and happy new
year.

Rafa³ Komorowski
removed_email_address@domain.invalid
GG: 4083718
http://homepage.mac.com/komor/iblog/