Use extract_options! rather than Hash test + pop. Closes #10628 [ssoroka]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8496 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jeremy Kemper
2007-12-28 03:58:01 +00:00
parent 57c613a601
commit 0c0610d398
2 changed files with 2 additions and 2 deletions

View File

@@ -1216,7 +1216,7 @@ module ActionController
opts = if args.empty? || Hash === args.first
args.first || {}
else
options = args.last.is_a?(Hash) ? args.pop : {}
options = args.extract_options!
args = args.zip(#{route.segment_keys.inspect}).inject({}) do |h, (v, k)|
h[k] = v
h

View File

@@ -1487,7 +1487,7 @@ module ActiveRecord #:nodoc:
self.class_eval %{
def self.#{method_id}(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
options = args.extract_options!
attributes = construct_attributes_from_arguments([:#{attribute_names.join(',:')}], args)
finder_options = { :conditions => attributes }
validate_find_options(options)