module Devise::Orm

def self.active_record?(model)

:nodoc:
def self.active_record?(model)
  defined?(ActiveRecord) && model < ActiveRecord::Base
end

def self.active_record_51?(model)

def self.active_record_51?(model)
  active_record?(model) && ActiveRecord.gem_version >= Gem::Version.new("5.1.x")
end

def self.included(model)

def self.included(model)
  if Devise::Orm.active_record_51?(model)
    model.include DirtyTrackingNewMethods
  else
    model.include DirtyTrackingOldMethods
  end
end