representable
representable copied to clipboard
parent accessor in nested property/collection
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?
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