dm-redis-adapter 0.6.0 → 0.6.1
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.
- data/README.textile +4 -0
- data/lib/dm-redis-adapter/adapter.rb +2 -2
- data/spec/dm_redis_associations_spec.rb +41 -0
- metadata +13 -13
data/README.textile
CHANGED
|
@@ -14,6 +14,9 @@ Please note that as of version 0.5.3 of the gem, the key names that are used for
|
|
|
14
14
|
|
|
15
15
|
h1. Changelog
|
|
16
16
|
|
|
17
|
+
|
|
18
|
+
* v0.6.1 Fixes a problem with deleting an object and not having it deleted from an assosciation (thanks @sheur!)
|
|
19
|
+
* v0.6.0 Refactor and change to the way that model names are stored in redis
|
|
17
20
|
* v0.5.3 Support for inheritance via sfeu and ujifgc, this version *breaks compatibility* with previous versions of the gem
|
|
18
21
|
* v0.4.0 Support for dm-core v1.1.0
|
|
19
22
|
* v0.3.0 Updates to support ruby 1.9.2 (thanks arbarlow!)
|
|
@@ -104,4 +107,5 @@ h1. Badass contributors
|
|
|
104
107
|
* <a href="http://github.com/arbarlow">Alex Barlow (arbarlow)</a> Fixes for ruby 1.9.2
|
|
105
108
|
* <a href="http://github.com/jof">Jonathan Lassoff (jof)</a> Fixes to support textual keys
|
|
106
109
|
* <a href="http://github.com/sfeu">Sebastian Feuerstack (sfeu)</a> Fixes to support inheritance
|
|
110
|
+
* <a href="http://github.com/sheur">Stephen Heuer (@sheur)</a> Fixes to deleted assosciations
|
|
107
111
|
|
|
@@ -92,10 +92,10 @@ module DataMapper
|
|
|
92
92
|
# @api semipublic
|
|
93
93
|
def delete(collection)
|
|
94
94
|
collection.each do |record|
|
|
95
|
-
@redis.del("#{collection.query.model.
|
|
95
|
+
@redis.del("#{collection.query.model.storage_name}:#{record[redis_key_for(collection.query.model)]}")
|
|
96
96
|
@redis.srem(key_set_for(collection.query.model), record[redis_key_for(collection.query.model)])
|
|
97
97
|
record.model.properties.select {|p| p.index}.each do |p|
|
|
98
|
-
@redis.srem("#{collection.query.model.
|
|
98
|
+
@redis.srem("#{collection.query.model.storage_name}:#{p.name}:#{encode(record[p.name])}", record[redis_key_for(collection.query.model)])
|
|
99
99
|
end
|
|
100
100
|
end
|
|
101
101
|
end
|
|
@@ -10,6 +10,47 @@ describe DataMapper::Adapters::RedisAdapter do
|
|
|
10
10
|
@redis.flushdb
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
+
it "should delete from association" do
|
|
14
|
+
class Book
|
|
15
|
+
include DataMapper::Resource
|
|
16
|
+
|
|
17
|
+
property :id, Serial
|
|
18
|
+
property :name, String
|
|
19
|
+
|
|
20
|
+
has n, :book_tags
|
|
21
|
+
has n, :tags, :through => :book_tags
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
class Tag
|
|
25
|
+
include DataMapper::Resource
|
|
26
|
+
|
|
27
|
+
property :id, Serial
|
|
28
|
+
property :name, String
|
|
29
|
+
|
|
30
|
+
has n, :book_tags
|
|
31
|
+
has n, :books, :through => :book_tags
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
class BookTag
|
|
35
|
+
include DataMapper::Resource
|
|
36
|
+
|
|
37
|
+
property :id, Serial
|
|
38
|
+
|
|
39
|
+
belongs_to :book
|
|
40
|
+
belongs_to :tag
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
DataMapper.finalize
|
|
44
|
+
|
|
45
|
+
b = Book.create(:name => "Harry Potter")
|
|
46
|
+
t = b.tags.create(:name => "fiction")
|
|
47
|
+
|
|
48
|
+
t.destroy
|
|
49
|
+
|
|
50
|
+
b2 = Book.get(b.id)
|
|
51
|
+
b2.tags.should_not == [t]
|
|
52
|
+
end
|
|
53
|
+
|
|
13
54
|
it "should allow has n :through" do
|
|
14
55
|
class Book
|
|
15
56
|
include DataMapper::Resource
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dm-redis-adapter
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.1
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -13,7 +13,7 @@ date: 2012-02-13 00:00:00.000000000Z
|
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: dm-core
|
|
16
|
-
requirement: &
|
|
16
|
+
requirement: &70246360561800 !ruby/object:Gem::Requirement
|
|
17
17
|
none: false
|
|
18
18
|
requirements:
|
|
19
19
|
- - ! '>='
|
|
@@ -21,10 +21,10 @@ dependencies:
|
|
|
21
21
|
version: 1.2.0
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
|
-
version_requirements: *
|
|
24
|
+
version_requirements: *70246360561800
|
|
25
25
|
- !ruby/object:Gem::Dependency
|
|
26
26
|
name: dm-types
|
|
27
|
-
requirement: &
|
|
27
|
+
requirement: &70246360561320 !ruby/object:Gem::Requirement
|
|
28
28
|
none: false
|
|
29
29
|
requirements:
|
|
30
30
|
- - ! '>='
|
|
@@ -32,10 +32,10 @@ dependencies:
|
|
|
32
32
|
version: 1.2.0
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
|
-
version_requirements: *
|
|
35
|
+
version_requirements: *70246360561320
|
|
36
36
|
- !ruby/object:Gem::Dependency
|
|
37
37
|
name: hiredis
|
|
38
|
-
requirement: &
|
|
38
|
+
requirement: &70246360560840 !ruby/object:Gem::Requirement
|
|
39
39
|
none: false
|
|
40
40
|
requirements:
|
|
41
41
|
- - ~>
|
|
@@ -43,10 +43,10 @@ dependencies:
|
|
|
43
43
|
version: 0.3.0
|
|
44
44
|
type: :runtime
|
|
45
45
|
prerelease: false
|
|
46
|
-
version_requirements: *
|
|
46
|
+
version_requirements: *70246360560840
|
|
47
47
|
- !ruby/object:Gem::Dependency
|
|
48
48
|
name: redis
|
|
49
|
-
requirement: &
|
|
49
|
+
requirement: &70246360560360 !ruby/object:Gem::Requirement
|
|
50
50
|
none: false
|
|
51
51
|
requirements:
|
|
52
52
|
- - ~>
|
|
@@ -54,7 +54,7 @@ dependencies:
|
|
|
54
54
|
version: '2.2'
|
|
55
55
|
type: :runtime
|
|
56
56
|
prerelease: false
|
|
57
|
-
version_requirements: *
|
|
57
|
+
version_requirements: *70246360560360
|
|
58
58
|
description: DataMapper adapter for the Redis key-value database
|
|
59
59
|
email: whoahbot@gmail.com
|
|
60
60
|
executables: []
|
|
@@ -78,7 +78,10 @@ files:
|
|
|
78
78
|
- spec/textual_keys_spec.rb
|
|
79
79
|
homepage: http://github.com/whoahbot/dm-redis-adapter
|
|
80
80
|
licenses: []
|
|
81
|
-
post_install_message:
|
|
81
|
+
post_install_message: ! "***********************************************************************************************\n\n
|
|
82
|
+
\ * IMPORTANT *\n This version of dm-redis changes the key names for data in Redis.\n
|
|
83
|
+
\ If you have been using dm-redis-adapter in the past, using this gem will not allow
|
|
84
|
+
you to\n retreive your data!\n\n***********************************************************************************************\n"
|
|
82
85
|
rdoc_options:
|
|
83
86
|
- --charset=UTF-8
|
|
84
87
|
require_paths:
|
|
@@ -89,9 +92,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
89
92
|
- - ! '>='
|
|
90
93
|
- !ruby/object:Gem::Version
|
|
91
94
|
version: '0'
|
|
92
|
-
segments:
|
|
93
|
-
- 0
|
|
94
|
-
hash: 3387811137579107358
|
|
95
95
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
96
|
none: false
|
|
97
97
|
requirements:
|