Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
- index 78b3507..9fb64b5 100644
- --- a/activerecord/lib/active_record/base.rb
- +++ b/activerecord/lib/active_record/base.rb
- @@ -961,9 +961,12 @@ module ActiveRecord #:nodoc:
- attribute_names = match.attribute_names
- super unless all_attributes_exists?(attribute_names)
- if match.finder?
- - options = arguments.extract_options!
- - relation = options.any? ? construct_finder_arel(options, current_scoped_methods) : scoped
- - relation.send :find_by_attributes, match, attribute_names, *arguments
- + self.class.send :define_method, method_id do |*args|
- + options = args.extract_options!
- + relation = options.any? ? construct_finder_arel(options, current_scoped_methods) : scoped
- + relation.send :find_by_attributes, match, attribute_names, *args
- + end
- + send(method_id, *arguments)
- elsif match.instantiator?
- scoped.send :find_or_instantiator_by_attributes, match, attribute_names, *arguments, &block
- end
Add Comment
Please, Sign In to add comment