Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix a couple of mistaken deprecation solutions

  • Loading branch information...
commit 146a013c425cf4883fa320ab685fb869dda03733 1 parent 84703be
@wycats wycats authored
View
2  activemodel/lib/active_model/validations.rb
@@ -135,7 +135,7 @@ def validate_on_#{type}(*args, &block)
ActiveSupport::Deprecation.warn(msg, caller)
options = args.extract_options!
options[:on] = :#{type}
- validate(args.push(options), &block)
+ validate(*args.push(options), &block)
end
RUBY
end
View
4 activemodel/lib/active_model/validations/callbacks.rb
@@ -28,7 +28,7 @@ module Callbacks
module ClassMethods
def before_validation(*args, &block)
- options = args.last
+ options = args.extract_options!
if options.is_a?(Hash) && options[:on]
options[:if] = Array.wrap(options[:if])
options[:if] << "self.validation_context == :#{options[:on]}"
@@ -53,7 +53,7 @@ def #{type}_validation_on_#{on}(*args, &block)
ActiveSupport::Deprecation.warn(msg, caller)
options = args.extract_options!
options[:on] = :#{on}
- before_validation(args.push(options), &block)
+ before_validation(*args.push(options), &block)
end
RUBY
end
Please sign in to comment.
Something went wrong with that request. Please try again.