lib/db_memoize/model.rb in db_memoize-0.3.14 vs lib/db_memoize/model.rb in db_memoize-0.4.0
- old
+ new
@@ -105,14 +105,16 @@
private
# rubocop:disable Style/EmptyBlockParameter
def create_memoized_alias_method(method_name)
- define_method "#{method_name}_with_memoize" do ||
- memoized_value(method_name)
+ unless method_defined?("#{method_name}_without_memoize")
+ alias_method "#{method_name}_without_memoize", method_name
end
- alias_method_chain method_name, :memoize
+ define_method method_name do ||
+ memoized_value(method_name)
+ end
end
# rubocop:disable Style/GuardClause
def create_memoized_values_association
unless reflect_on_association(:memoized_values)