representable icon indicating copy to clipboard operation
representable copied to clipboard

parent accessor in nested property/collection

Open enneid opened this issue 9 years ago • 1 comments

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?

enneid avatar Oct 18 '16 12:10 enneid

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

apotonick avatar Oct 18 '16 21:10 apotonick