Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 0c0610d398a89f5a74c9fee593eee1bb10975a46 1 parent 57c613a
Jeremy Kemper jeremy authored
2  actionpack/lib/action_controller/routing.rb
View
@@ -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
2  activerecord/lib/active_record/base.rb
View
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.