aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2012-07-27 12:01:25 +0100
committerJon Leighton <j@jonathanleighton.com>2012-07-27 13:34:12 +0100
commit6a81ccd69d96f36f4322ef927191ab5a35e68d68 (patch)
treeeefd3b92255fa3969e412c88633332a47808f3c5 /activemodel
parentf1afd7765c2a35cc77e1ee40466db36f181e29f5 (diff)
downloadrails-6a81ccd69d96f36f4322ef927191ab5a35e68d68.tar.gz
rails-6a81ccd69d96f36f4322ef927191ab5a35e68d68.tar.bz2
rails-6a81ccd69d96f36f4322ef927191ab5a35e68d68.zip
ActiveRecord::Base.all returns a Relation.
Previously it returned an Array. If you want an array, call e.g. `Post.to_a` rather than `Post.all`. This is more explicit. In most cases this should not break existing code, since Relations use method_missing to delegate unknown methods to #to_a anyway.
Diffstat (limited to 'activemodel')
-rw-r--r--activemodel/lib/active_model/observing.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/observing.rb b/activemodel/lib/active_model/observing.rb
index ca206ee9aa..976dcf23d8 100644
--- a/activemodel/lib/active_model/observing.rb
+++ b/activemodel/lib/active_model/observing.rb
@@ -215,7 +215,7 @@ module ActiveModel
# end
# end
def observed_classes
- Array(observed_class)
+ [observed_class].compact.flatten
end
# The class observed by default is inferred from the observer's class name: