Module: Devise::Orm

Defined in:
lib/devise/orm.rb

Overview

:nodoc:

Defined Under Namespace

Modules: DirtyTrackingNewMethods, DirtyTrackingOldMethods

Class Method Summary collapse

Class Method Details

.active_record?(model) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/devise/orm.rb', line 3

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

.active_record_51?(model) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/devise/orm.rb', line 7

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

.included(model) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/devise/orm.rb', line 11

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