module Foreigner
  module Helper
    def self.active_record_version
      if ::ActiveRecord.respond_to? :version
        ActiveRecord.version
      elsif ::ActiveRecord::VERSION
        Gem::Version.new(::ActiveRecord::VERSION)
      else
        raise "Unknown ActiveRecord Version API"
      end
    end
  end
end

module Foreigner
  module Helper
    def self.active_record_version
      if ::ActiveRecord.respond_to? :version
        ActiveRecord.version
      elsif ::ActiveRecord::VERSION::STRING
        Gem::Version.new(::ActiveRecord::VERSION::STRING)
      else
        raise "Unknown ActiveRecord Version API"
      end
    end
  end
end

Fix ActiveRecord version retrieval on Rails 3
Fix ActiveRecord version retrieval on Rails 3

Previously a889deb tried to create a Gem::Version out of a module rather than
the full version string, causing:

    ArgumentError: Malformed version number string ActiveRecord::VERSION

This fixes broken tests (https://travis-ci.org/matthuhiggins/foreigner/builds/56370433)
and db:migrate on Rails 3.2.
