Follow Along as I Stumble on the Path to Learning RoR

Limiting the .each Results

On one of my views I pull in results to display, but I needed a way to figure out how to limit the results.

For example:

@posts.each do |post|

This Stack Overflow question helped me find the answer:

I ended up doing this to limit the display to 8:

@posts.take(8).each do |post|


Comments are closed.