Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix deprecated Relation#all in Rails 4, use Relation#to_a instead

DEPRECATION WARNING: Relation#all is deprecated. If you want to eager-load a relation, you can call #load (e.g. `Post.where(published: true).load`). If you want to get an array of records from a relation, you can call #to_a (e.g. `Post.where(published: true).to_a`). (called from followers at .../socialization/lib/socialization/stores/active_record/follow.rb:69)
  • Loading branch information...
commit 2e1fc432cc7d1f24c5503429616a344ce47c3313 1 parent fafd54e
@thomas88 thomas88 authored
View
4 lib/socialization/stores/active_record/follow.rb
@@ -66,7 +66,7 @@ def followers_relation(followable, klass, opts = {})
def followers(followable, klass, opts = {})
rel = followers_relation(followable, klass, opts)
if rel.is_a?(ActiveRecord::Relation)
- rel.all
+ rel.to_a
else
rel
end
@@ -92,7 +92,7 @@ def followables_relation(follower, klass, opts = {})
def followables(follower, klass, opts = {})
rel = followables_relation(follower, klass, opts)
if rel.is_a?(ActiveRecord::Relation)
- rel.all
+ rel.to_a
else
rel
end
View
4 lib/socialization/stores/active_record/like.rb
@@ -66,7 +66,7 @@ def likers_relation(likeable, klass, opts = {})
def likers(likeable, klass, opts = {})
rel = likers_relation(likeable, klass, opts)
if rel.is_a?(ActiveRecord::Relation)
- rel.all
+ rel.to_a
else
rel
end
@@ -92,7 +92,7 @@ def likeables_relation(liker, klass, opts = {})
def likeables(liker, klass, opts = {})
rel = likeables_relation(liker, klass, opts)
if rel.is_a?(ActiveRecord::Relation)
- rel.all
+ rel.to_a
else
rel
end
View
4 lib/socialization/stores/active_record/mention.rb
@@ -66,7 +66,7 @@ def mentioners_relation(mentionable, klass, opts = {})
def mentioners(mentionable, klass, opts = {})
rel = mentioners_relation(mentionable, klass, opts)
if rel.is_a?(ActiveRecord::Relation)
- rel.all
+ rel.to_a
else
rel
end
@@ -92,7 +92,7 @@ def mentionables_relation(mentioner, klass, opts = {})
def mentionables(mentioner, klass, opts = {})
rel = mentionables_relation(mentioner, klass, opts)
if rel.is_a?(ActiveRecord::Relation)
- rel.all
+ rel.to_a
else
rel
end
View
4 lib/socialization/stores/redis/base.rb
@@ -11,7 +11,7 @@ def actors(victim, klass, options = {})
result
end
else
- actors_relation(victim, klass, options).all
+ actors_relation(victim, klass, options).to_a
end
end
@@ -32,7 +32,7 @@ def victims(actor, klass, options = {})
result
end
else
- victims_relation(actor, klass, options).all
+ victims_relation(actor, klass, options).to_a
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.