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. .
Trackback this post | Subscribe to the comments via RSS Feed