Sha256: 7a91b9a62c646b346969017732475583f87dbd538d858ae25c593c28c43b50b8
Contents?: true
Size: 1.05 KB
Versions: 2
Compression:
Stored size: 1.05 KB
Contents
# frozen_string_literal: true module Clowne module Adapters # :nodoc: all class ActiveRecord module Resolvers class UnknownAssociation < StandardError; end class Association class << self # rubocop: disable Metrics/ParameterLists def call(source, record, declaration, adapter:, params:, **_options) reflection = source.class.reflections[declaration.name.to_s] if reflection.nil? raise UnknownAssociation, "Association #{declaration.name} couldn't be found for #{source.class}" end cloner_class = Associations.cloner_for(reflection) cloner_class.new(reflection, source, declaration, adapter, params).call(record) record end # rubocop: enable Metrics/ParameterLists end end end end end end Clowne::Adapters::ActiveRecord.register_resolver( :association, Clowne::Adapters::ActiveRecord::Resolvers::Association, before: :nullify )
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
clowne-1.1.0 | lib/clowne/adapters/active_record/resolvers/association.rb |
clowne-1.0.0 | lib/clowne/adapters/active_record/resolvers/association.rb |