Problem 3 #4
Answered
by
UlugbekPulathodjaev
bahriddin-abdusalomov
asked this question in
Q&A
-
Paginator Modelga qanday prop lar yozsa boladi? |
Beta Was this translation helpful? Give feedback.
Answered by
UlugbekPulathodjaev
Oct 17, 2023
Replies: 1 comment
-
with will_paginate : @records = #do your work and fetch array of records you want to paginate ( various types ) current_page = params[:page] || 1 <%=will_paginate @records%> |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
bahriddin-abdusalomov
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
with will_paginate :
@records = #do your work and fetch array of records you want to paginate ( various types )
then do the following :
current_page = params[:page] || 1
per_page = 10
@records = WillPaginate::Collection.create(current_page, per_page, records.size) do |pager|
pager.replace(@records)
end
then in your view :
<%=will_paginate @records%>