Skip to content

Commit

Permalink
MONGOID-4052 use ActiveSupport's extract_options method
Browse files Browse the repository at this point in the history
  • Loading branch information
estolfo committed Jul 4, 2016
1 parent f78b26d commit 688abd6
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/mongoid/criteria/queryable/optional.rb
Expand Up @@ -148,13 +148,8 @@ def no_timeout
#
# @since 1.0.0
def only(*args)
if args[-1].is_a?(Hash)
opts = args[-1]
args = args[0...-1].flatten
else
opts = {}
args = args.flatten
end
opts = args.extract_options!
args = args.flatten
opts[:localize] = opts.fetch(:localize, false)
option(*args) do |options|
options.store(
Expand Down

0 comments on commit 688abd6

Please sign in to comment.