From a98db7c6ef7384d60a1c7f02d43ee601e2647eea Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sat, 27 Mar 2010 11:50:11 -0700 Subject: Use Array.wrap uniformly --- activemodel/lib/active_model/callbacks.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'activemodel/lib/active_model/callbacks.rb') diff --git a/activemodel/lib/active_model/callbacks.rb b/activemodel/lib/active_model/callbacks.rb index a7e0cf90c1..d4e98de57b 100644 --- a/activemodel/lib/active_model/callbacks.rb +++ b/activemodel/lib/active_model/callbacks.rb @@ -1,3 +1,4 @@ +require 'active_support/core_ext/array/wrap' require 'active_support/callbacks' module ActiveModel @@ -91,7 +92,7 @@ module ActiveModel options = callbacks.extract_options! options = { :terminator => "result == false", :scope => [:kind, :name] }.merge(options) - types = Array(options.delete(:only)) + types = Array.wrap(options.delete(:only)) types = [:before, :around, :after] if types.empty? callbacks.each do |callback| @@ -124,10 +125,10 @@ module ActiveModel def self.after_#{callback}(*args, &block) options = args.extract_options! options[:prepend] = true - options[:if] = Array(options[:if]) << "!halted && value != false" + options[:if] = Array.wrap(options[:if]) << "!halted && value != false" set_callback(:#{callback}, :after, *(args << options), &block) end CALLBACK end end -end \ No newline at end of file +end -- cgit v1.2.3