Rake: How to determine the Rails version?


#1

Hi all

I’m learning to use Rake for migration etc.
I wonder if there’s a way to determine the currently used Rails version,
so e.g. when installing a new engine using Rake I could check if there’s
a version used that’s older as needed and so abort the installation. You
know what I mean? :wink:

Thanks and greetings,
Joshua


#2

Hi Joshua

script/about will give you the rails version (guess there’s probably a
way
to retrieve that programmatically).

hth

Thibaut


#3

Rails::VERSION::MAJOR
Rails::VERSION::MINOR
Rails::VERSION::TINY

Or for all three as a string:

Rails::VERSION::STRING

Tom