Page representer#93
Conversation
|
Cool! Loving the idea + implementation. We have to be careful, though. The pagination I suggest in the blog post doesn't follow any MIME format (like HAL or Collection-JSON), I made it up to demonstrate how Roar works. Everything we merge into Roar's core will be used by people as they might assume we're following a standard (the only standard we follow is the Roar standard). That's the same with We should either discuss a generic format (I am secretly working on Object-HAL with @mikekelly) or we should move this into a gem (either Don't get me wrong @summera - I love what you did! We just have to be careful with core additions (lesson learned 😉 ). What you think? |
|
@apotonick Yea! Sounds good to me. ;) I'm cool with discussing a generic format and getting a Am I wrong in thinking that this pagination implementation would follow the HAL standard by simply including class VenuesRepresenter < Roar::Decorator
include Roar::Representer::JSON::HAL
include Roar::Rails::PageRepresenter
end |
|
Not sure how pagination is defined in HAL - I don't recall that being specified in the official document at all! That's why I'm cautious about merging this. I also checked your other PR #92 which could go into your Are you ok with that? Thanks for your work and trying to help others by publishing what you found helpful - this is exactly how Open-Source is meant to work! ❤️ |
|
Yep, no problem. I agree 💯 . I'll get crankin on a |
|
@apotonick Finally got the time to get started on roar-contrib. Haven't made a release yet. Let me know if you have any comments/suggestions 😀 |
|
That is incredibly cool, @summera, especially because you set a standard for discussion. This gem will help many people understanding how some things work in Roar. Please, keep me in the loop and I will promote it. ❤️ |
This is a
PageRepresenterbased off @apotonick blog post. It can be used with Kaminari or will_paginate to easily include pagination with your Decorator Representers.This can also be used with the
CollectionRepresenter(#92) to create a paginated representerI updated the README with an explanation.