Hi all,
i want to do paging in my project.
i am trying to using will_paginate but i can not do it.
i am follow following step
- download will_paginate and put in vendor/plugin/
- require ‘will_paginate’ in config/environment.rb
- i want to use paging in image display so that in image controller
def index
@images = Image.paginate :page => params[:page], :per_page => 5
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @images }
end
end
- in Image model
def self.per_page
4
end - in index.html.erb
<%= will_paginate @image%>