Module: ActiveRecordUpsert::ActiveRecord

Defined in:
lib/active_record_upsert/active_record.rb,
lib/active_record_upsert/active_record/persistence.rb

Defined Under Namespace

Modules: Persistence

Class Method Summary collapse

Class Method Details

.includedObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/active_record_upsert/active_record.rb', line 3

def self.included(*)
  require 'active_record_upsert/active_record/persistence'
  ::ActiveRecord::Base.extend ActiveRecordUpsert::ActiveRecord::Persistence

  if ::ActiveRecord::VERSION::MAJOR == 5
    require 'active_record_upsert/active_record5/relation'

    ::ActiveRecord::Relation.include ActiveRecordUpsert::ActiveRecord5::Relation
  elsif ::ActiveRecord::VERSION::MAJOR == 6
    require 'active_record_upsert/active_record6/relation'

    ::ActiveRecord::Relation.include ActiveRecordUpsert::ActiveRecord6::Relation
  end
end