is it possible to dynamically create controller code??
for example if you have a parent element @parent and children element
@parent.daughter and @parent.son.
@parent.daughter.class = daughter
@parent.son.class = son
so if we wanted to add a dog to all of our sons or all of our daughters
when a controller element is called we would have to do something like
if @child.class == son
for son in @parent.sons
son.dog = true
for daughter in @parent.daughters
daughter.dog = true
Duplicating code like this is annoying and not very DRY is anything like
this remotely possible instead ??
child_type = @child.class
for child_type in @parent.child_type+s
child_type.dog = true
this would cut code almost in half, for this situation. If there is
anything capable of dynamically generating controller code based on
object classes or even defined variables please let me know!!