copious-activerecord-activesalesforce-adapter 2.2.3 → 2.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -131,7 +131,7 @@ module ActiveRecord
131
131
  @entity_def_map = {}
132
132
  @keyprefix_to_entity_def_map = {}
133
133
 
134
- @command_boxcar = []
134
+ @command_boxcar = nil
135
135
  @class_to_entity_map = {}
136
136
  end
137
137
 
@@ -250,6 +250,9 @@ module ActiveRecord
250
250
  previous_command = command
251
251
  end
252
252
  end
253
+
254
+ # Discard the command boxcar
255
+ @command_boxcar = nil
253
256
 
254
257
  # Finish off the partial boxcar
255
258
  send_commands(commands) unless commands.empty?
@@ -260,7 +263,7 @@ module ActiveRecord
260
263
  # done if the transaction block raises an exception or returns false.
261
264
  def rollback_db_transaction()
262
265
  log('Rolling back boxcar', 'rollback_db_transaction()')
263
- @command_boxcar = []
266
+ @command_boxcar = nil
264
267
  end
265
268
 
266
269
 
@@ -398,7 +401,7 @@ module ActiveRecord
398
401
 
399
402
  # Track the id to be able to update it when the create() is actually executed
400
403
  id = String.new
401
- @command_boxcar << ActiveSalesforce::BoxcarCommand::Insert.new(self, sobject, id)
404
+ queue_command ActiveSalesforce::BoxcarCommand::Insert.new(self, sobject, id)
402
405
 
403
406
  id
404
407
  }
@@ -426,7 +429,7 @@ module ActiveRecord
426
429
 
427
430
  sobject = create_sobject(entity_def.api_name, id, fields, null_fields)
428
431
 
429
- @command_boxcar << ActiveSalesforce::BoxcarCommand::Update.new(self, sobject)
432
+ queue_command ActiveSalesforce::BoxcarCommand::Update.new(self, sobject)
430
433
  #}
431
434
  end
432
435
 
@@ -447,7 +450,7 @@ module ActiveRecord
447
450
  ids_element = []
448
451
  ids.each { |id| ids_element << :ids << id }
449
452
 
450
- @command_boxcar << ActiveSalesforce::BoxcarCommand::Delete.new(self, ids_element)
453
+ queue_command ActiveSalesforce::BoxcarCommand::Delete.new(self, ids_element)
451
454
  }
452
455
  end
453
456
 
@@ -777,6 +780,21 @@ module ActiveRecord
777
780
  def debug(msg)
778
781
  @logger.debug(msg) if @logger
779
782
  end
783
+
784
+ protected
785
+
786
+ def queue_command(command)
787
+ # If @command_boxcar is not nil, then this is a transaction
788
+ # and commands should be queued in the boxcar
789
+ if @command_boxcar
790
+ @command_boxcar << command
791
+
792
+ # If a command is not executed within a transaction, it should
793
+ # be executed immediately
794
+ else
795
+ send_commands([command])
796
+ end
797
+ end
780
798
 
781
799
  end
782
800
 
metadata CHANGED
@@ -1,18 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: copious-activerecord-activesalesforce-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.3
4
+ version: 2.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doug Chasman
8
8
  - Luigi Montanez
9
9
  - Senthil Nayagam
10
10
  - Justin Ball
11
+ - Jesse Hallett
11
12
  autorequire:
12
13
  bindir: bin
13
14
  cert_chain: []
14
15
 
15
- date: 2008-12-18 00:00:00 -08:00
16
+ date: 2008-12-19 00:00:00 -08:00
16
17
  default_executable:
17
18
  dependencies:
18
19
  - !ruby/object:Gem::Dependency
@@ -23,6 +24,9 @@ dependencies:
23
24
  - - ">="
24
25
  - !ruby/object:Gem::Version
25
26
  version: 2.0.2
27
+ - - <
28
+ - !ruby/object:Gem::Version
29
+ version: "2.2"
26
30
  version:
27
31
  - !ruby/object:Gem::Dependency
28
32
  name: builder
@@ -78,9 +82,9 @@ files:
78
82
  - test/unit/recorded_results/AsfUnitTestsBasicTest.test_find_a_contact.recording
79
83
  - test/unit/recorded_results/AsfUnitTestsBasicTest.test_find_a_contact_by_first_name.recording
80
84
  - README
81
- has_rdoc: false
85
+ has_rdoc: true
82
86
  homepage: http://activesfdc.rubyforge.org/
83
- post_install_message: "this version is compatible with Rails 2.2,\n please report any bug in the group\n http://groups.google.com/group/activesalesforce\n "
87
+ post_install_message: "this version is compatible with Rails 2.1,\n please report any bug in the group\n http://groups.google.com/group/activesalesforce\n "
84
88
  rdoc_options: []
85
89
 
86
90
  require_paths: