Ruby rails version

June 7, 2009

The simplest way would be to just run this command:

ruby script/about

and you will get Ruby version, Rails version and much more. Another standard way to check the versions of both Ruby and Rails from the command line is:

Ruby -v
Rails -v

And if you want to check it from the code?

To check the Ruby on Rails version from the code you should access this Rails constant – Rails::VERSION::STRING

To test it, you can run the console “ruby script/console” and in the console prompt check the version constant “Rails::VERSION::STRING”

> script/console
Loading development environment.
>> Rails::VERSION::STRING
=> "2.3.0"
>> exit

PS. There also used to be a cool way to run the about script from the web on the development environment (somewhat similar to phpinfo()) by going to this page: http://127.0.0.1:3000/rails/info/properties, but it is seemingly deprecated in the latest Rails (in my 2.3.2 at least it doesn’t work) and it gives an error: No route matches “/rails/info/properties” with {:method=>:get}

Entry Filed under: Uncategorized. .

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Recent posts

Starting to learn Rails?

Archive

Recent comments

gogetakame on Installing Rails on Windows (3…
gogetakame on Installing Rails on Windows (3…
allaboutruby on Installing Rails on Windows (3…
Harsha on Installing Rails on Windows (3…
Eddy Josafat on Google Maps API in Rails (YM4R…