Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

properties/collections with a defined 'getter' block ignore represent_with parameter #55

Open
bglusman opened this issue Sep 28, 2013 · 0 comments

Comments

@bglusman
Copy link

We started using Roar::Decorator's a while ago so I forget if this was an issue on modules too, but definitely the case on Decorator's.... I've been burned by this a few times now when I forget about it, it feels like a bug to me, but perhaps it's documented/known? Seems like it would be nice to use it when it's specified though.

To provide an example:

class V3::AnswerRepresenter < Roar::Decorator

property :id
property :response, represent_with: V3::ResponseRepresenter, getter: ->(opts) { responses.first }, embedded: true

end

Normally this would work fine without the getter option, but when the getter is present, it's response is not passed through the specified representer and instead has to_json called on it directly or something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant