Problem with nested representers

37 views
Skip to first unread message

Marcel Augsburger

unread,
Jan 23, 2014, 6:27:46 PM1/23/14
to roar...@googlegroups.com
I have a Bill model, which has a Paperwork collection, both with their respective representers. When I create a bill with the from_json method, the bill gets created with all the paperworks, but with all the paperworks' properties nil.

Any idea of what could be happening or how to test it?

Was there a version of roar that had problems with this? I'm using 0.11.19 (can't get a few things to work from 0.12 on).

Thanks in advance!

Nick Sutterer

unread,
Jan 23, 2014, 7:08:36 PM1/23/14
to roar...@googlegroups.com
What is not working with 0.12? You should definitely upgrade.

Give me the JSON and the PaperworkRepresenter code.


--
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.

Marcel Augsburger

unread,
Jan 29, 2014, 5:52:41 PM1/29/14
to roar...@googlegroups.com
Sorry for the lag. It took me a while but I finally know what wasn't working: I was including the representers and also extending from them, so the from_json mapped to the fields included by the representer instead of the fields of the ORM (Mongoid).

About the problems I have with roar > 0.11.19: pagination... I'm not sure how it works, but it used to work the way you showed it here http://nicksda.apotomo.de/2012/05/ruby-on-rest-6-pagination-with-roar/
until roar-rails 1.0. In later versions I got this error:
undefined local variable or method `current_page' for String
same with the other pagination methods 'next_page' and 'previous_page'

How does pagination work now?



2014-01-23 Nick Sutterer <apot...@gmail.com>
Reply all
Reply to author
Forward
0 new messages