attr_cached 1.1 → 1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/attr_cached.rb +6 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d242c82d648d83b5138bc10af56ecf57dd8c0cdd
|
4
|
+
data.tar.gz: afa543a7b7797523483bdae99d5d15f423417c2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72ab6acba13a562b4a4e1d85508abd8043e5a6a50c73ddeeae5f7158075b6964ebb45906e0e9d4c3b9c29bae01356c8b977d71a40c56c029be0745a2acf7d55e
|
7
|
+
data.tar.gz: f235f9d5dac99d38ee65386998b36046a4697d185903f165efbbdd348162340ef5822a663538329d037d9d67bd05a923d61a430f2344beb527e297a417827573
|
data/lib/attr_cached.rb
CHANGED
@@ -22,6 +22,12 @@ class ActiveRecord::Base
|
|
22
22
|
raise missing_id if id.nil?
|
23
23
|
Rails.cache.write(key + id.to_s, value)
|
24
24
|
end
|
25
|
+
|
26
|
+
# Define the method to delete the attribute from the cache
|
27
|
+
define_method "delete_#{attribute}" do
|
28
|
+
raise missing_id if id.nil?
|
29
|
+
Rails.cache.delete(key + id.to_s)
|
30
|
+
end
|
25
31
|
end
|
26
32
|
end
|
27
33
|
|