Saturday, 10 August 2013

Rails 4: find all records

Rails 4: find all records

Now that ActiveRecord::Relation#all is deprecated in Rails 4, how are you
supposed to iterate all records?
Used to be like:
Foo.all.each do |foo|
# whatever
end
I can approximate it now like so, but it feels dirty:
Foo.where(true).each do |foo|
# whatever
end
Is there a better way?

No comments:

Post a Comment