Sha256: 2af16be2048542979a612cc266acec90088b64a3b4878a0dee4ceb0ad1a35ca7

Contents?: true

Size: 302 Bytes

Versions: 8

Compression:

Stored size: 302 Bytes

Contents

module ActiveMocker
  module Mock

    class BelongsTo < SingleRelation

      attr_reader :item

      def initialize(item, child_self:, foreign_key:, foreign_id:)
        child_self.send(:write_attribute, foreign_key, foreign_id) if item.try(:persisted?)
        super
      end

    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
active_mocker-1.7.3 lib/active_mocker/mock/belongs_to.rb
active_mocker-1.7.2 lib/active_mocker/mock/belongs_to.rb
active_mocker-1.7.1 lib/active_mocker/mock/belongs_to.rb
active_mocker-1.7.1rc lib/active_mocker/mock/belongs_to.rb
active_mocker-1.7 lib/active_mocker/mock/belongs_to.rb
active_mocker-1.7rc2 lib/active_mocker/mock/belongs_to.rb
active_mocker-1.7.beta3 lib/active_mocker/mock/belongs_to.rb
active_mocker-1.7.beta2 lib/active_mocker/mock/belongs_to.rb