app/models/run.rb
# connect target to self association
# assoc_target_type shows dependency; :dependant or :dependee
connect target to self association
assoc_target_type shows dependency; :dependant or :dependee
connect target to self association assoc_target_type shows dependency ; : dependant or : dependee
def connect(target)
    connection_factors.to_a.each do |cond|
      if cond.is_a?(Array)
        precond, poscond = cond
        pre, pos = precond.split('.'), poscond.split('.')
        case assoc_target_type
          when :dependee  
            if pos.first == Self_Entity
              value = pre.first == target_model.table_name ? target.send(pre.last) : pre.first
              self.assoc_entity.send "#{pos.last}=", value
            elsif pre.first == Self_Entity
              value = pos.first == target_model.table_name ? target.send(pos.last) : pos.first
              self.assoc_entity.send "#{pre.last}=", value
            end
          when :dependant  
            if pos.first == target.table_name
              target.content[pos.last] =  (pre.first == Self_Entity ? assoc_entity.send(pre.last) : pre.first)
            elsif pre.first == target.table_name
              target.content[pre.last] =  (pos.first == Self_Entity ? assoc_entity.send(pos.last) : pos.first)
            end
        end
      end
    end
  end
def connect ( target ) connection_factors . to_a . each do | cond | if cond . is_a? ( Array ) precond , poscond = cond pre , pos = precond . split ( '.' ) , poscond . split ( '.' ) case assoc_target_type when :dependee if pos . first == Self_Entity value = pre . first == target_model . table_name ? target . send ( pre . last ) : pre . first self . assoc_entity . send "#{pos.last}=" , value elsif pre . first == Self_Entity value = pos . first == target_model . table_name ? target . send ( pos . last ) : pos . first self . assoc_entity . send "#{pre.last}=" , value end when :dependant if pos . first == target . table_name target . content [ pos . last ] = ( pre . first == Self_Entity ? assoc_entity . send ( pre . last ) : pre . first ) elsif pre . first == target . table_name target . content [ pre . last ] = ( pos . first == Self_Entity ? assoc_entity . send ( pos . last ) : pos . first ) end end end end end
connect target to self association
assoc_target_type shows dependency; :dependant or :dependee
connect target to self association assoc_target_type shows dependency ; : dependant or : dependee
# target is dependee and an entity; assoc_entity is dependant and an entity.  # target is dependant and an EntityRef; assoc_entity is dependee and an entity.
target
<not_specific>