Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print Rails version in views?

I'm wondering how to display the current Rails version in a view. I already know that this will print the current Ruby version:

<%= RUBY_VERSION %>

But I'm not sure how to do this for Rails.

Edit: I tried to use <%= debug(request.env) %> to list all environment variables; unfortunately the Rails version isn't one of them.

like image 229
hao_maike Avatar asked Dec 30 '11 17:12

hao_maike


People also ask

How do I check my Rails version?

Step 1: Check Ruby VersionOpen the command prompt and type ruby -v. If Ruby responds, and if it shows a version number at or above 2.2. 2, then type gem --version. If you don't get an error, skip Install Ruby step.

How do I print a variable in Ruby on Rails?

The commands p (print) and pp (pretty print) can be used to evaluate Ruby expressions and display the value of variables to the console.


1 Answers

You can just do :

<%= Rails.version %>
like image 110
Cydonia7 Avatar answered Oct 18 '22 02:10

Cydonia7