Is it possible to delegate a function or series of functions to one of multiple other objects based on conditional logic?
Ex:
class Item
has_one :thing
has_one :other_thing
delegate :foo,
:bar
to: :[thing or other_thing]
end
In this case, I would want the actions foo and bar to either be delegated to the thing, or the other thing based on some conditional logic.
Possibly related: Active Record with Delegate and conditions
Aucun commentaire:
Enregistrer un commentaire