Sha256: 8473c07c964f2702971e07d233ded8b31df0dbc4b4ac50b73dea13b8a66852b2

Contents?: true

Size: 275 Bytes

Versions: 31

Compression:

Stored size: 275 Bytes

Contents

# frozen_string_literal: true
module ActiveMocker
  class HasOne < SingleRelation
    attr_reader :item

    def initialize(item, child_self:, foreign_key:)
      item.send(:write_attribute, foreign_key, item.try(:id)) unless item.try(:id).nil?
      super
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
active_mocker-2.6.2 lib/active_mocker/mock/has_one.rb
active_mocker-2.6.1.beta2 lib/active_mocker/mock/has_one.rb
active_mocker-2.6.1.beta lib/active_mocker/mock/has_one.rb
active_mocker-2.6.0 lib/active_mocker/mock/has_one.rb
active_mocker-2.5.4 lib/active_mocker/mock/has_one.rb
active_mocker-2.5.3 lib/active_mocker/mock/has_one.rb
active_mocker-2.5.2 lib/active_mocker/mock/has_one.rb
active_mocker-2.5.1 lib/active_mocker/mock/has_one.rb
active_mocker-2.5.1.pre lib/active_mocker/mock/has_one.rb
active_mocker-2.5.0 lib/active_mocker/mock/has_one.rb
active_mocker-2.4.4 lib/active_mocker/mock/has_one.rb
active_mocker-2.4.3 lib/active_mocker/mock/has_one.rb
active_mocker-2.4.2 lib/active_mocker/mock/has_one.rb
active_mocker-2.4.1 lib/active_mocker/mock/has_one.rb
active_mocker-2.4.0 lib/active_mocker/mock/has_one.rb
active_mocker-2.4.0.pre5 lib/active_mocker/mock/has_one.rb
active_mocker-2.3.4 lib/active_mocker/mock/has_one.rb
active_mocker-2.4.0.pre4 lib/active_mocker/mock/has_one.rb
active_mocker-2.4.0.pre3 lib/active_mocker/mock/has_one.rb
active_mocker-2.4.0.pre2 lib/active_mocker/mock/has_one.rb