How do you tell the Rails version inside of a Rails app?

nop*_*ole 4 ruby-on-rails

Up to Rails 2.3.8, there is a constant:

RAILS_GEM_VERSION   "2.3.8"
Run Code Online (Sandbox Code Playgroud)

but Rails 3.0.0 doesn't have it. Is there other ways?

gaq*_*qzi 5

使用Rails.version.

您可能需要从该类访问Rails中可能需要的大多数环境信息.

文档.