active-record-transactioner 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,19 +1,23 @@
1
1
  = active-record-transactioner
2
2
 
3
- trans = ActiveRecordTransactioner.new
4
-
5
3
  #Iterate a million times - will save each 1000 in a transaction with "save!".
6
- models.each do |model|
7
- trans.queue(model)
4
+ ActiveRecordTransactioner.new do |trans|
5
+ models.each do |model|
6
+ trans.queue(model)
7
+ end
8
8
  end
9
9
 
10
10
  #You can also do it a bit more complicated.
11
- trans = ActiveRecordTransactioner.new(
11
+ ActiveRecordTransactioner.new(
12
12
  :call_args => ["Hello world!"],
13
13
  :call_method => :save!,
14
14
  :transaction_method => :transaction,
15
15
  :transaction_size => 1000
16
- )
16
+ ) do |trans|
17
+ models.each do |model|
18
+ trans.queue(model)
19
+ end
20
+ end
17
21
 
18
22
  == Contributing to active-record-transactioner
19
23
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "active-record-transactioner"
8
- s.version = "0.0.3"
8
+ s.version = "0.0.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kasper Johansen"]
12
- s.date = "2013-04-08"
12
+ s.date = "2013-04-09"
13
13
  s.description = "Queue up calls to specific models and execute them in transactions, after a certain number of models have been added."
14
14
  s.email = "kj@gfish.com"
15
15
  s.extra_rdoc_files = [
@@ -72,6 +72,15 @@ class ActiveRecordTransactioner
72
72
  rescue => e
73
73
  puts e.inspect
74
74
  puts e.backtrace
75
+
76
+ if e.is_a?(NoMethodError) and e.message.to_s.include?("`reverse' for nil:NilClass")
77
+ puts
78
+ puts "Warning: Known Rails reverse error when using transaction - retrying in 2 sec."
79
+ sleep 2
80
+ puts "Retrying"
81
+ puts
82
+ retry
83
+ end
75
84
  ensure
76
85
  @threads.delete(Thread.current)
77
86
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active-record-transactioner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-08 00:00:00.000000000 Z
12
+ date: 2013-04-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -112,7 +112,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
112
112
  version: '0'
113
113
  segments:
114
114
  - 0
115
- hash: 2734069812813830044
115
+ hash: 1215318973199029384
116
116
  required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  none: false
118
118
  requirements: