× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

Using #find_each over #each in Rails 4

R.J. Robinson
May 25, 2016
<p>Memory management will become a big thing in your rails apps. As a new developer , you may not concern yourself with such things. <br> <br> #each on an active record model will first pull in every record in that model or sub-set. </p> <p>```ruby</p> <p>SomeModel.find_each do | model |</p> <p>...  </p> <p>#do something<br> ...</p> <p>end</p> <p>```</p> <p> will load each record independently, and not bog down your precious system resources. Memory management comes later, but think about it now!  </p>
comments powered by Disqus