Permalink
Browse files

Use extract_options! rather than Hash test + pop. Closes #10628 [ssor…

…oka]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8496 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 57c613a commit 0c0610d398a89f5a74c9fee593eee1bb10975a46 @jeremy jeremy committed Dec 28, 2007
Showing with 2 additions and 2 deletions.
  1. +1 −1 actionpack/lib/action_controller/routing.rb
  2. +1 −1 activerecord/lib/active_record/base.rb
@@ -1216,7 +1216,7 @@ def #{selector}(*args)
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
@@ -1487,7 +1487,7 @@ def method_missing(method_id, *arguments)
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)

0 comments on commit 0c0610d

Please sign in to comment.