Module: HasUuid::ActiveRecord::Associations::Builder::CollectionAssociation

Extended by:
ActiveSupport::Concern
Defined in:
lib/has_uuid/active_record/associations/builder/collection_association.rb

Defined Under Namespace

Modules: RedefinedReader, RedefinedWriter

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/has_uuid/active_record/associations/builder/collection_association.rb', line 8

def self.included(base)
  if ::ActiveRecord::VERSION::STRING >= "4.1"
    base.class_eval do
      base.extend RedefinedReader
      base.extend RedefinedWriter

      class << self
        alias_method_chain :define_readers, :uuid_args
        alias_method_chain :define_writers, :uuid_args
      end
    end

  else
    base.class_eval do
      include RedefinedReader
      include RedefinedWriter

      alias_method_chain :define_readers, :uuid_no_args
      alias_method_chain :define_writers, :uuid_no_args
    end
  end
end