I have a page where i go through all categories, and show the latest 3
games for each one. Right now i include those games when i fetch the
categories in the controller:
Is there a way to limit those games here to the amount that i want? It
seems a bit inefficient to get all games per category here, and limit
those in the view.
I have a page where i go through all categories, and show the latest 3
games for each one. Right now i include those games when i fetch the
categories in the controller:
Is there a way to limit those games here to the amount that i want? It
seems a bit inefficient to get all games per category here, and limit
those in the view.
you can add a :limit => n
number to the declaration in the model (has_many .. :limit => ) or
whatever as the default limitation for the association you want to
query.