Monday, 26 August 2013

Rails 4 equivalent of Rails 3 'Model.all'

Rails 4 equivalent of Rails 3 'Model.all'

In Rails 3 if I wanted to hit the db I'd take .all on the end of a query.
This is useful for when I'm doing things like refreshing cache on writes
(so reads always hit cache).
Now in Rails 4, Model.all returns an ActiveRecord::Relation object (ie
doesn't hit the db). What is the best way to get it actually go to the db
and return the records specified?

No comments:

Post a Comment