def relationship_for(relationship)
      # We need to run both regexes, because the plurality of the @owner module name is 
      # important
      plural_regex   = /((.*)_)?(#{Regexp.quote(@owner.class._module.name.downcase)})(_(.*))?/
      singular_regex = /((.*)_)?(#{Regexp.quote(@owner.class._module.name.downcase.singularize)})(_(.*))?/
      # Break the loop if we match
      [plural_regex, singular_regex].each {|r| break if relationship.match(r)}
      # Assign sane values to things if we didnt match
      o   = $3
      o   = @owner.class._module.name.downcase if o.nil? || o.empty?
      t   = [$2, $5].compact.join('_')
      t   = @link_field if t.nil? || t.empty?
      # Look up the cardinality
      o_c, t_c = cardinality_for(o,t)
      {:owner   => {:name => o, :cardinality => o_c},
       :target  => {:name => t, :cardinality => t_c}}
    end
def relationship_for(relationship)
      # We need to run both regexes, because the plurality of the @owner module name is 
      # important
      plural_regex   = /((.*)_)?(#{Regexp.quote(@owner.class._module.name.downcase)})(_(.*))?/
      singular_regex = /((.*)_)?(#{Regexp.quote(@owner.class._module.name.downcase.singularize)})(_(.*))?/
      # Break the loop if we match
      [plural_regex, singular_regex].each {|r| break if relationship.match(r)}
      # Assign sane values to things if we didnt match
      o   = $3
      o   = @owner.class._module.name.downcase if o.nil? || o.empty?
      t   = [$2, $5].compact.join('_')
      t   = @link_field if t.nil? || t.empty?
      # Look up the cardinality
      o_c, t_c = cardinality_for(o,t)
      {:owner   => {:name => o, :cardinality => o_c},
       :target  => {:name => t, :cardinality => t_c}}
    end
This method breaks the relationship into parts and returns them