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

parent accessor in nested property/collection #199

Open
enneid opened this issue Oct 18, 2016 · 1 comment
Open

parent accessor in nested property/collection #199

enneid opened this issue Oct 18, 2016 · 1 comment

Comments

@enneid
Copy link

enneid commented Oct 18, 2016

i have situation:

class SuperModelRepresenter < Representable::Decorator

  collection metadata as: info do
    property arg1
    property arg2 #some properties are somehow evaluate with SuperModel
  end
end

In nested property, iI don't have access to parent. if there is any pattern to achive this functionality?

@apotonick
Copy link
Member

It's not the representer's job to model your data, that's your data layer's responsibility. Remember that your "model" doesn't have to be a model.

I use twins to model my data, and they have a Parent feature: http://trailblazer.to/gems/disposable/api.html

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

2 participants