onyx-cache-money 0.2.5.3 → 0.2.5.4
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/lib/cash/write_through.rb +2 -3
- data/spec/cash/write_through_spec.rb +13 -1
- metadata +1 -1
data/lib/cash/write_through.rb
CHANGED
@@ -36,9 +36,8 @@ module Cash
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def shallow_clone
|
39
|
-
clone = self.
|
40
|
-
clone.
|
41
|
-
clone.instance_variable_set("@new_record", new_record?)
|
39
|
+
clone = Object.instance_method(:clone).bind(self).call
|
40
|
+
clone.clear_association_cache
|
42
41
|
clone
|
43
42
|
end
|
44
43
|
|
@@ -48,7 +48,19 @@ module Cash
|
|
48
48
|
story = Story.new(:title => 'I am lugubrious')
|
49
49
|
story.characters.build(:name => 'How am I holy?')
|
50
50
|
story.save!
|
51
|
-
Story.get("id/#{story.id}").first.characters.loaded?.
|
51
|
+
Story.get("id/#{story.id}").first.characters.loaded?.should be_false
|
52
|
+
end
|
53
|
+
|
54
|
+
it "caches extended behavior" do
|
55
|
+
story = Story.new(:title => 'I am special')
|
56
|
+
module SpecialBehavior
|
57
|
+
def special_behavior
|
58
|
+
'woo!'
|
59
|
+
end
|
60
|
+
end
|
61
|
+
story.extend(SpecialBehavior)
|
62
|
+
story.save!
|
63
|
+
Story.get("id/#{story.id}").first.special_behavior.should == 'woo!'
|
52
64
|
end
|
53
65
|
|
54
66
|
it 'increments the count' do
|