mongoid_cacheable 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,7 +17,14 @@ module Mongoid
17
17
  alias_method uncached_name, name
18
18
  alias_method cached_name, field_name
19
19
 
20
- define_method(name) { |*args| attributes[field_name] ||= send(uncached_name) }
20
+ define_method(name) do
21
+ unless attributes[field_name]
22
+ send "#{field_name}=", send(uncached_name)
23
+ save
24
+ end
25
+
26
+ attributes[field_name]
27
+ end
21
28
  end
22
29
  end
23
30
  end
@@ -1,3 +1,3 @@
1
1
  module MongoidCacheable
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_cacheable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
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-08-15 00:00:00.000000000 Z
12
+ date: 2012-08-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mongoid