diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2009-12-29 15:53:06 +0530 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-12-29 15:53:06 +0530 |
commit | 3b8853eda45dfcae2a1e71b890668730e63bed02 (patch) | |
tree | c4f78fef103689d6b0fdf8d1b4ac27fad9115aed /activerecord/lib | |
parent | 0a1ff1a14ffcc96204ba1d391207d13e68cda8b0 (diff) | |
download | rails-3b8853eda45dfcae2a1e71b890668730e63bed02.tar.gz rails-3b8853eda45dfcae2a1e71b890668730e63bed02.tar.bz2 rails-3b8853eda45dfcae2a1e71b890668730e63bed02.zip |
Replace Base#safe_to_array with Array.wrap
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 6715871bf9..07c5545171 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1645,7 +1645,7 @@ module ActiveRecord #:nodoc: # Merges includes so that the result is a valid +include+ def merge_includes(first, second) - (safe_to_array(first) + safe_to_array(second)).uniq + (Array.wrap(first) + Array.wrap(second)).uniq end def merge_joins(*joins) @@ -1657,7 +1657,7 @@ module ActiveRecord #:nodoc: end joins.flatten.map{|j| j.strip}.uniq else - joins.collect{|j| safe_to_array(j)}.flatten.uniq + joins.collect{|j| Array.wrap(j)}.flatten.uniq end end @@ -1674,18 +1674,6 @@ module ActiveRecord #:nodoc: }.join(" ") end - # Object#to_a is deprecated, though it does have the desired behavior - def safe_to_array(o) - case o - when NilClass - [] - when Array - o - else - [o] - end - end - def array_of_strings?(o) o.is_a?(Array) && o.all?{|obj| obj.is_a?(String)} end |