When writing a piece of reusable code, you sometimes need to have separate code for Rails 2 and Rails 3. You can distinguish between Rails versions like this:
if Rails.version < '3' # mind the quotes
  # Rails 2 code goes here
else
  # Rails 3+ code goes here
end
Posted by Henning Koch to makandra dev (2011-08-29 13:27)