Sha256: 31b8f4ce483a9a60cb47d2157917d9140b50029457577ad9897130bbe260310d

Contents?: true

Size: 694 Bytes

Versions: 5

Compression:

Stored size: 694 Bytes

Contents

# encoding: UTF-8

module Goldiloader
  module AssociationOptions
    extend self

    OPTIONS = [:fully_load].freeze

    # This is only used in Rails 5+
    module AssociationBuilderExtension
      def self.build(model, reflection)
        # We have no callbacks to register
      end

      def self.valid_options
        OPTIONS
      end
    end

    def register
      if ::ActiveRecord::VERSION::MAJOR >= 5
        ActiveRecord::Associations::Builder::Association.extensions << AssociationBuilderExtension
      else
        ActiveRecord::Associations::Builder::Association.valid_options.concat(OPTIONS)
      end
    end

    private
  end
end

Goldiloader::AssociationOptions.register

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
goldiloader-2.1.2 lib/goldiloader/association_options.rb
goldiloader-2.1.1 lib/goldiloader/association_options.rb
goldiloader-2.1.0 lib/goldiloader/association_options.rb
goldiloader-2.0.1 lib/goldiloader/association_options.rb
goldiloader-2.0.0 lib/goldiloader/association_options.rb