In the docs,
https://github.com/apotonick/roar-rails/#passing-options
If I do this in the controller:
respond_with @people, represent_with => PeopleRepresenter, :page_numberz => 5
(I've tried it both as a single hash with :represent_with, as well as individual params as above)
And this in the representer:
property :page_numberz
I get method not found.
How is this supposed to be done?
Im trying to implement pagination. In my controller I have magic to parse the query string for page and per_page then I do the appropriate queries to get the right records. Then in my HAL output, I include collection metadata for pagination. I was expecting to pass things like total_pages from the controller to the representer by using paramaters
Eg:
{
"total_pages": 1,
"page": 1,
"total_records": 1,
"_embedded": {
"people": [
{
"first_name": "Ayla",
"last_name": "Erdman",
"middle_name": "Graham",
Josh Cohen
jos...@gmail.com | @joshco
--
You received this message because you are subscribed to the Google Groups "Roar" group.
To unsubscribe from this group and stop receiving emails from it, send an email to roar-talk+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
No, I'm not sure how to do that.
In my controller, I have:
def index
@people=get_pages(Person)
respond_with @people, :represent_with => PeopleRepresenter, :page_numberz => 5
end
Since I have to call get_pages (which looks at params[] to figure out what query to run), I didn’t see how to do that with something like:
class SingersController < ApplicationController
represents :json, :entity => MusicianRepresenter, :collection => MusicianCollectionRepresenter
Can you give me the code line to replace my respond_with to test?
represents :json, :collection => PeopleRepresenter
Where would this line go?
When I replaced the respond_with line (in my index action), I got unknown method represents