db_memoize 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/db_memoize/model.rb +8 -0
- data/lib/db_memoize/version.rb +1 -1
- 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: 4e6c10e2d8dffe1ff21a88e3f1349df1402a4df5
|
4
|
+
data.tar.gz: ee681aef3dc8e05bd34877dc1ec9717486f8000d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27051ef728eeeeb41e3e5b7927fd1abaa464f7ac3f22e3ab5536a7788f86670f754f0c08feb3768aa4107c1d19f4ce2df38b156bbb3900651f1e29cb7ff19229
|
7
|
+
data.tar.gz: e4ea6308907c9627a61fca6981d0dbc78ac5c179f7425cd2235061a7ebf5a78e692143748cc3cde5eafdfe60147ae082dfd277b726efe0550eae08703bce4f0a
|
data/lib/db_memoize/model.rb
CHANGED
@@ -70,10 +70,18 @@ module DbMemoize
|
|
70
70
|
|
71
71
|
module ClassMethods
|
72
72
|
def db_memoize(method_name)
|
73
|
+
@db_memoized_methods ||= []
|
74
|
+
@db_memoized_methods.push(method_name.to_sym)
|
75
|
+
|
73
76
|
create_alias_method(method_name)
|
74
77
|
create_memoized_values_association
|
75
78
|
end
|
76
79
|
|
80
|
+
def db_memoized_methods
|
81
|
+
methods = @db_memoized_methods || []
|
82
|
+
superclass.respond_to?(:db_memoized_methods) ? (superclass.db_memoized_methods + methods).uniq : methods
|
83
|
+
end
|
84
|
+
|
77
85
|
def unmemoize(records_or_ids, method_name = :all)
|
78
86
|
conditions = {
|
79
87
|
entity_table_name: table_name,
|
data/lib/db_memoize/version.rb
CHANGED