diff options
author | wycats <wycats@gmail.com> | 2010-04-11 14:53:17 -0700 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-04-11 14:53:17 -0700 |
commit | 803df08d896b82ae3e86c9c1e3c2ea4b6826ef70 (patch) | |
tree | b813371e844a9a05ba33beb6582335d3617f66ee /activerecord/lib/active_record/callbacks.rb | |
parent | 76e0a9eb5b5ad17d51dad5e4e8c5ea1ed504ea88 (diff) | |
parent | 1f80b8b04f9783ea7a5f39bd7ce27248bc57a851 (diff) | |
download | rails-803df08d896b82ae3e86c9c1e3c2ea4b6826ef70.tar.gz rails-803df08d896b82ae3e86c9c1e3c2ea4b6826ef70.tar.bz2 rails-803df08d896b82ae3e86c9c1e3c2ea4b6826ef70.zip |
Merge branch 'master' of github.com:rails/rails
Diffstat (limited to 'activerecord/lib/active_record/callbacks.rb')
-rw-r--r-- | activerecord/lib/active_record/callbacks.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/callbacks.rb b/activerecord/lib/active_record/callbacks.rb index add5d99ca6..98c14e6eb0 100644 --- a/activerecord/lib/active_record/callbacks.rb +++ b/activerecord/lib/active_record/callbacks.rb @@ -1,3 +1,5 @@ +require 'active_support/core_ext/array/wrap' + module ActiveRecord # Callbacks are hooks into the lifecycle of an Active Record object that allow you to trigger logic # before or after an alteration of the object state. This can be used to make sure that associated and @@ -250,7 +252,7 @@ module ActiveRecord def before_validation(*args, &block) options = args.last if options.is_a?(Hash) && options[:on] - options[:if] = Array(options[:if]) + options[:if] = Array.wrap(options[:if]) options[:if] << "@_on_validate == :#{options[:on]}" end set_callback(:validation, :before, *args, &block) @@ -259,7 +261,7 @@ module ActiveRecord def after_validation(*args, &block) options = args.extract_options! options[:prepend] = true - options[:if] = Array(options[:if]) + options[:if] = Array.wrap(options[:if]) options[:if] << "!halted && value != false" options[:if] << "@_on_validate == :#{options[:on]}" if options[:on] set_callback(:validation, :after, *(args << options), &block) |