Created
June 16, 2014 15:25
-
-
Save javifr/fd9037c0e26c607b9d32 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Normal locations fetching | |
# page_url IS http://localhost:3000/api/v1/locations?page=1 | |
# Nearby locations fetching | |
# page_url SHOULD BE http://localhost:3000/api/v1/locations?latitude=41.406410&longitude=2.191986&distance=10&near=true?page=1 | |
# page_url IS http://localhost:3000/api/v1/locations?page=1 | |
# How can i maintain this params? | |
# ?latitude=41.406410&longitude=2.191986&distance=10&near=true? | |
module LocationsRepresenter | |
include Roar::Representer::JSON::HAL | |
include PaginationRepresenter | |
collection :items, :extend => LocationRepresenter, embedded: true | |
def page_url(*args) | |
v1_locations_url(*args) | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The representer can't access
params
, this is a horrible global concept from Rails. Pass in what you need: https://github.com/apotonick/representable#passing-options