From 8d337e9ec2e25007d557150dbe7557ab3c3bd05f Mon Sep 17 00:00:00 2001 From: Eloy Duran Date: Fri, 3 Oct 2008 13:55:35 +0200 Subject: Dynamic finders should use the ActiveRecord::Base::find method instead of ::find_initial, :find_last, and ::find_all. This is so when people override ActiveRecord::Base::find, the new ::find method will also be invoked by the dynamic finders. Associations for instance do go through ::find, so this makes it more consistent. Also removed the unnecessary deprecation silence blocks. Signed-off-by: Michael Koziarski [#1162 state:committed] --- activerecord/lib/active_record/base.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'activerecord/lib/active_record/base.rb') diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 69ea155ace..3e8c573d09 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1724,10 +1724,10 @@ module ActiveRecord #:nodoc: #{'result = ' if bang}if options[:conditions] with_scope(:find => finder_options) do - ActiveSupport::Deprecation.silence { send(:#{finder}, options) } + find(:#{finder}, options) end else - ActiveSupport::Deprecation.silence { send(:#{finder}, options.merge(finder_options)) } + find(:#{finder}, options.merge(finder_options)) end #{'result || raise(RecordNotFound)' if bang} end @@ -1750,9 +1750,9 @@ module ActiveRecord #:nodoc: options = { :conditions => find_attributes } set_readonly_option!(options) - record = find_initial(options) + record = find(:first, options) - if record.nil? + if record.nil? record = self.new { |r| r.send(:attributes=, attributes, guard_protected_attributes) } #{'yield(record) if block_given?'} #{'record.save' if instantiator == :create} -- cgit v1.2.3