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.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Documentation needs to call out the actual working of :synchronize.
Example
Let's say we have a ActiveRecord model Item and we are using something like:
classItem < ApplicationRecorddefself.is_active?return@activeif@active@active=self.activeendend# In controllerdefsome_function@items=Item.all# some changes to @items which changes :active fieldItem.import(@items,synchronize: @items,synchronize_keys: [:shop_id,:cart_id],on_duplicate_key_update: :all)end
The expectation after import is that @items got synchronized with import updates in place. However, the @active instance variable is not reset which should be explicitly called out in the documentation.
Issue
Documentation needs to call out the actual working of
:synchronize
.Example
Let's say we have a ActiveRecord model
Item
and we are using something like:The expectation after
import
is that@items
got synchronized withimport
updates in place. However, the@active
instance variable is not reset which should be explicitly called out in the documentation.Code explanation
activerecord-import/lib/activerecord-import/synchronize.rb
Line 46 in 20c1d3a
From this file (and line)
@attributes
are being set in memory with fresh values from import call.@new_record
@destroyed
) are being changed.Docs should explicitly call this out because if
@items
had its own custom instance variables they wont be replaced or reset to nil.The text was updated successfully, but these errors were encountered: