Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (27 sloc) 900 Bytes
# frozen_string_literal: true
require 'clowne/adapters/active_record/associations/base'
require 'clowne/adapters/active_record/associations/noop'
require 'clowne/adapters/active_record/associations/has_one'
require 'clowne/adapters/active_record/associations/has_many'
require 'clowne/adapters/active_record/associations/has_and_belongs_to_many'
module Clowne
module Adapters # :nodoc: all
class ActiveRecord
module Associations
AR_2_CLONER = {
has_one: HasOne,
has_many: HasMany,
has_and_belongs_to_many: HABTM
}.freeze
# Returns an association cloner class for reflection
def self.cloner_for(reflection)
if reflection.is_a?(::ActiveRecord::Reflection::ThroughReflection)
Noop
else
AR_2_CLONER.fetch(reflection.macro, Noop)
end
end
end
end
end
end
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.