Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/netsuite_rails/record_sync.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def netsuite_extract_from_record(netsuite_record)
end

if association_keys.include?(local_field)
field_value = reflection_attributes[local_field].
field_value = reflection_attributes[reflection_attributes.keys.first.class == String ? local_field.to_s : local_field].
klass.
where(netsuite_id: field_value.internal_id).
first_or_initialize
Expand Down
2 changes: 1 addition & 1 deletion lib/netsuite_rails/record_sync/push_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def build_netsuite_record(local_record, opts = {})

# TODO pretty sure this will break if we are dealing with has_many

netsuite_field_value = if reflections.has_key?(local_field)
netsuite_field_value = if reflections.has_key?(reflections.keys.first.class == String ? local_field.to_s : local_field)
if (remote_internal_id = local_record.send(local_field).try(:netsuite_id)).present?
{ internal_id: remote_internal_id }
else
Expand Down