kasket 3.1.0 → 3.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/kasket/read_mixin.rb +2 -2
- data/lib/kasket/version.rb +2 -2
- data/test/fixtures/authors.yml +2 -0
- data/test/read_mixin_test.rb +12 -0
- data/test/schema.rb +1 -0
- data/test/test_models.rb +1 -0
- metadata +4 -4
data/lib/kasket/read_mixin.rb
CHANGED
@@ -63,7 +63,7 @@ module Kasket
|
|
63
63
|
def store_in_kasket(key, records)
|
64
64
|
if records.size == 1
|
65
65
|
if records.first.kasket_cacheable?
|
66
|
-
Kasket.cache.write(key, records.first.
|
66
|
+
Kasket.cache.write(key, records.first.attributes.dup)
|
67
67
|
end
|
68
68
|
elsif records.empty?
|
69
69
|
ActiveRecord::Base.logger.info("[KASKET] would have stored an empty resultset") if ActiveRecord::Base.logger
|
@@ -71,7 +71,7 @@ module Kasket
|
|
71
71
|
if records.all?(&:kasket_cacheable?)
|
72
72
|
instance_keys = records.map do |record|
|
73
73
|
instance_key = kasket_key_for_id(record.id)
|
74
|
-
Kasket.cache.write(instance_key, record.
|
74
|
+
Kasket.cache.write(instance_key, record.attributes.dup)
|
75
75
|
instance_key
|
76
76
|
end
|
77
77
|
|
data/lib/kasket/version.rb
CHANGED
data/test/fixtures/authors.yml
CHANGED
data/test/read_mixin_test.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require File.expand_path("helper", File.dirname(__FILE__))
|
2
2
|
|
3
3
|
class ReadMixinTest < ActiveSupport::TestCase
|
4
|
+
fixtures :authors
|
5
|
+
|
4
6
|
context "find by sql with kasket" do
|
5
7
|
setup do
|
6
8
|
@post_database_result = { 'id' => 1, 'title' => 'Hello' }
|
@@ -64,4 +66,14 @@ class ReadMixinTest < ActiveSupport::TestCase
|
|
64
66
|
|
65
67
|
end
|
66
68
|
|
69
|
+
should "support serialized attributes" do
|
70
|
+
author = authors(:mick)
|
71
|
+
|
72
|
+
author = Author.find(author.id)
|
73
|
+
assert_equal({'sex' => 'male'}, author.metadata)
|
74
|
+
|
75
|
+
author = Author.find(author.id)
|
76
|
+
assert_equal({'sex' => 'male'}, author.metadata)
|
77
|
+
end
|
78
|
+
|
67
79
|
end
|
data/test/schema.rb
CHANGED
data/test/test_models.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kasket
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-06-
|
13
|
+
date: 2013-06-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|
@@ -184,7 +184,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
184
184
|
version: '0'
|
185
185
|
segments:
|
186
186
|
- 0
|
187
|
-
hash:
|
187
|
+
hash: -3331408880632426003
|
188
188
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
189
|
none: false
|
190
190
|
requirements:
|
@@ -193,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
193
|
version: '0'
|
194
194
|
segments:
|
195
195
|
- 0
|
196
|
-
hash:
|
196
|
+
hash: -3331408880632426003
|
197
197
|
requirements: []
|
198
198
|
rubyforge_project:
|
199
199
|
rubygems_version: 1.8.25
|