ampere 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.2.1
4
+
5
+ * Model saves and multi-attribute updates are now completely atomic, using
6
+ the MULTI and EXEC commands.
7
+
3
8
  ## 1.2.0
4
9
 
5
10
  * Ampere model IDs are now integers. They are still stored internally the
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.0
1
+ 1.2.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "ampere"
8
- s.version = "1.2.0"
8
+ s.version = "1.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Max Thom Stahl"]
12
- s.date = "2012-06-15"
12
+ s.date = "2012-07-12"
13
13
  s.description = "An ActiveRecord/Mongoid-esque object model for the Redis key/value data store."
14
14
  s.email = "max@villainousindustri.es"
15
15
  s.extra_rdoc_files = [
@@ -137,8 +137,10 @@ module Ampere
137
137
  @id = Ampere.connection.incr('__guid')
138
138
  end
139
139
 
140
- self.attributes.each do |k, v|
141
- Ampere.connection.hset(key_for_find(self.class, @id), k, k =~ /_id$/ ? v : Marshal.dump(v))
140
+ Ampere.connection.multi do
141
+ self.attributes.each do |k, v|
142
+ Ampere.connection.hset(key_for_find(self.class, @id), k, k =~ /_id$/ ? v : Marshal.dump(v))
143
+ end
142
144
  end
143
145
 
144
146
  self.class.indices.each do |index|
@@ -329,9 +331,11 @@ module Ampere
329
331
 
330
332
  define_method(:"#{field_name}=") do |val|
331
333
  val.each do |v|
332
- Ampere.connection.sadd(key_for_has_many(to_s.downcase, self.id, field_name), v.id)
333
- # Set pointer for belongs_to
334
- Ampere.connection.hset(key_for_find(v.class, v.id), "#{my_klass_name}_id", self.send("id"))
334
+ Ampere.connection.multi do
335
+ Ampere.connection.sadd(key_for_has_many(to_s.downcase, self.id, field_name), v.id)
336
+ # Set pointer for belongs_to
337
+ Ampere.connection.hset(key_for_find(v.class, v.id), "#{my_klass_name}_id", self.send("id"))
338
+ end
335
339
  end
336
340
  end
337
341
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ampere
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
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: 2012-06-15 00:00:00.000000000 Z
12
+ date: 2012-07-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -299,7 +299,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
299
299
  version: '0'
300
300
  segments:
301
301
  - 0
302
- hash: -2028445124986586521
302
+ hash: 1755195159909274501
303
303
  required_rubygems_version: !ruby/object:Gem::Requirement
304
304
  none: false
305
305
  requirements: