Thanks, I was looking for a gem to get this done and then I found this tutorial :)
@UlfredTag2 жыл бұрын
Thank you so much for this! The perfect solution to my problem
@Encoreencore2 жыл бұрын
Amazing tutorial. Thanks Jesus!
@JesusCastello Жыл бұрын
Glad you enjoyed it!
@btechstuff4 жыл бұрын
This was very informative, thank you friend.
@JesusCastello4 жыл бұрын
Glad it was helpful! :)
@CristianMolina3 жыл бұрын
Great , thx! Do you have something showing how to move the pagination stuff to a controller concern? Regards!
@wmcraver5 жыл бұрын
It seem like it would be pretty easy to add some logic to calculate the max number of possible pages based on the total number of items (total books / books_per_page and use the ceil command). Then Add some ERB logic so that the last page doesn't show on page 0 and so that next page doesn't show on the max page, yeah?
@detrix424 жыл бұрын
Thank you very much. Yes, pagination is not that hard. I needed this video to be reminded of the offset method.
@JesusCastello4 жыл бұрын
Glad it was helpful! :)
@SamNeter3 жыл бұрын
A question - how can you remove 'Last Page' and 'Next Page' on pages where there is no last page (the first page) and no next page (on the final page of results) - so it detects when there are no further books to paginate so it removes the option? Hope that makes sense!
@JesusCastello3 жыл бұрын
That is a great question Sam! You'll need to use some logic statements to solve this. In other words, you need if statements to check if the next page would have more books on it or not, if it doesn't then you skip the ERB (or HAML, Slim, etc.) code for the "Next Page" section.
@EfstathiosStivaros5 жыл бұрын
Really enjoyed this, thanks. A lot of the time we reach for gems which do basic functions and add foreign code into our apps which we don't need. I know I'm definitely guilty.
@sunn19m3 жыл бұрын
This is a great tutorial video! Thank you! Also, do you have a video on setting up those individual book/images as links? I could probably find it elsewhere; but I like the way you have your page set up! Thank you!
@JesusCastello3 жыл бұрын
For each book you can use the link_to method. api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-link_to
@sunn19m3 жыл бұрын
@@JesusCastello Thank you!
@rubyhat4 жыл бұрын
Thanks!
@jackblack26155 жыл бұрын
Thank you
@devgalileu4 жыл бұрын
Awesome, a great tutorial, totally unecessary use gems to achieve this.
@JesusCastello4 жыл бұрын
Agreed! :)
@bryanperez41484 жыл бұрын
you're awesome
@JesusCastello4 жыл бұрын
Thanks! :)
@ShashiKumar-jt2xk4 жыл бұрын
please add search option
@JesusCastello4 жыл бұрын
You can find it here: kzbin.info/www/bejne/bYOzo2tpe754oac