ruby on rails - Where does a .paginate(...) call belong? -


Now in my controller this is:

  DIF index @ quote = vote pagered ( Page: Page = & gt; Parameter [: Page] ,: Order => "Created DASC")   

But I think For index /. Html.erb (or partial in that directory). Pagnetinet I think it is in the scene because it manages how the vote collection will be displayed. Am I understanding MVC separation correctly?

No, you want it in controller

#paginate < / Code> changes its query so that it has a boundary and a starting point.

So if you have 100 records, your page will call some things with Page 2 (30) Offset (30) OFFSET (30) / Ex>

and it will only return 30 records. If you do this in this view, then your @ quotes will have 1000 records and what is necessary will be cut off.

Your view should be politically dumb and it should be repeated on the records which the controller gives (the model that meets it).

Comments