ampere 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -0
- data/VERSION +1 -1
- data/ampere.gemspec +2 -2
- data/lib/ampere/model.rb +9 -5
- metadata +3 -3
data/CHANGELOG.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.1
|
data/ampere.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "ampere"
|
8
|
-
s.version = "1.2.
|
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-
|
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 = [
|
data/lib/ampere/model.rb
CHANGED
@@ -137,8 +137,10 @@ module Ampere
|
|
137
137
|
@id = Ampere.connection.incr('__guid')
|
138
138
|
end
|
139
139
|
|
140
|
-
|
141
|
-
|
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.
|
333
|
-
|
334
|
-
|
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.
|
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-
|
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:
|
302
|
+
hash: 1755195159909274501
|
303
303
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
304
304
|
none: false
|
305
305
|
requirements:
|