From 2a9eed2a3c83bee2d56cb8b2889add27e9b4dddc Mon Sep 17 00:00:00 2001 From: Taylor Carr Date: Sun, 7 Aug 2016 01:33:00 -0400 Subject: [PATCH 1/2] Fix update to AR reflection keys being strings not symbols --- lib/netsuite_rails/record_sync/push_manager.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/netsuite_rails/record_sync/push_manager.rb b/lib/netsuite_rails/record_sync/push_manager.rb index d2eef3c..ae453df 100644 --- a/lib/netsuite_rails/record_sync/push_manager.rb +++ b/lib/netsuite_rails/record_sync/push_manager.rb @@ -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 From a39566274765ebe6fd99e0f6d6007fdfc0de0e0d Mon Sep 17 00:00:00 2001 From: Taylor Carr Date: Mon, 8 Aug 2016 17:10:22 -0400 Subject: [PATCH 2/2] RecordSync add reflection keys as string support --- lib/netsuite_rails/record_sync.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/netsuite_rails/record_sync.rb b/lib/netsuite_rails/record_sync.rb index 8478d77..c0c07e6 100644 --- a/lib/netsuite_rails/record_sync.rb +++ b/lib/netsuite_rails/record_sync.rb @@ -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