lib/db_memoize/model.rb in db_memoize-0.1.4 vs lib/db_memoize/model.rb in db_memoize-0.1.5
- old
+ new
@@ -68,11 +68,19 @@
DbMemoize.logger.info "DbMemoize <#{self.class.name} id: #{id}>##{method_name} - #{msg}"
end
module ClassMethods
def db_memoize(method_name)
+ @db_memoized_methods ||= []
+ @db_memoized_methods.push(method_name.to_sym)
+
create_alias_method(method_name)
create_memoized_values_association
+ end
+
+ def db_memoized_methods
+ methods = @db_memoized_methods || []
+ superclass.respond_to?(:db_memoized_methods) ? (superclass.db_memoized_methods + methods).uniq : methods
end
def unmemoize(records_or_ids, method_name = :all)
conditions = {
entity_table_name: table_name,