def rails?(*args)
      version, comparator = args.pop, (args.pop || :==)
      result =
        if version.nil?
          defined?(::Rails)
        elsif defined?(::Rails)
          if ::Rails.respond_to?(:version)
            rails_version = Rails.version.to_f
            rails_version = rails_version.floor if version.is_a?(Integer)
            rails_version.send(comparator, version.to_f)
          else
            version.to_f <= 2.0
          end
        else
          false
        end
      !!result
    end
def rails?(*args)
      version, comparator = args.pop, (args.pop || :==)
      result =
        if version.nil?
          defined?(::Rails)
        elsif defined?(::Rails)
          if ::Rails.respond_to?(:version)
            rails_version = Rails.version.to_f
            rails_version = rails_version.floor if version.is_a?(Integer)
            rails_version.send(comparator, version.to_f)
          else
            version.to_f <= 2.0
          end
        else
          false
        end
      !!result
    end
Return a boolean indicating whether the Rails constant is defined.
 It cannot identify Rails < 2.1

 Example:
 rails?(3) => true if Rails major version is 3
 rails?(3.0) => true if Rails major.minor version is 3.0
 rails?(:>=, 3) => true if Rails major version is >= 3
 rails?(:>=, 3.1) => true if Rails major.minor version is >= 3.1