Public feed #723112

Someone

public text v1 · immutable
Raw Edit
·published 2007-10-02 15:10 UTC
rendered paste body
# controller 

@people_page, @people = paginate :people, :per_page => 5

the :people is the name of the model, the @people_page is the page reference and the @people is the collection of data (recordset)


#view

	<% for people in @people %>
		<%= link_to people.name, :action => 'show', :id => people.id %><br>
	<% end -%>

that obviously loops through the collection of data and drags them out 1 by 1.

<%= link_to "<", { :page => @people_page.current.previous } if @people_page.current.previous %>
<%= link_to ">", { :page => @people_page.current.next } if @people_page.current.next %>

and this is the next and previous links. if @people_page.current.previous is true, show the link