def active_record?(*args)
      version, comparator = args.pop, (args.pop || :==)
      result =
        if version.nil?
          defined?(::ActiveRecord)
        elsif defined?(::ActiveRecord)
          ar_version = ::ActiveRecord::VERSION::STRING.to_f
          ar_version = ar_version.floor if version.is_a?(Integer)
          ar_version.send(comparator, version.to_f)
        else
          false
        end
      !!result
    end
def active_record?(*args)
      version, comparator = args.pop, (args.pop || :==)
      result =
        if version.nil?
          defined?(::ActiveRecord)
        elsif defined?(::ActiveRecord)
          ar_version = ::ActiveRecord::VERSION::STRING.to_f
          ar_version = ar_version.floor if version.is_a?(Integer)
          ar_version.send(comparator, version.to_f)
        else
          false
        end
      !!result
    end
Return a boolean indicating whether the version of ActiveRecord matches
 the constraints in the args.

 == Arguments
 Optional comparator function as a symbol followed by a version number
 as an integer or float.

 If the version is an integer only the major version is compared.
 if the version is a float the major.minor version is compared.

 If called with no arguments returns a boolean indicating whether ActiveRecord
 is defined.

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