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.
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.
The commands p (print) and pp (pretty print) can be used to evaluate Ruby expressions and display the value of variables to the console.
You can just do :
<%= Rails.version %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With