Displaying 2 results from an estimated 2 matches for "relationshiptyp".
Did you mean:
relationshiptype
2006 Mar 13
2
HowToHandleMultipleRelationshipsBetweenTables?
I have two tables where one of the tables contains two columns that
reference the id of the other.
This problem is partially described in the "HowTo..." with the topic
title above.
My model looks like this:
class Relationship < ActiveRecord::Base
belongs_to :relationshiptype, :foreign_key => "relnshiptype"
belongs_to :relationshiptype, :foreign_key => "inverserelnshiptype"
end
It doesn''t work because I think you can''t specify the same model
valiable? "relationshiptype" more than once.
The table is "relatio...
2006 Apr 17
0
Pros/cons of doubling up in Self-Referential has_many via :through
...is to leave the
relationship with a single entry in the relationship table and add an
instance method to the model which bundles up those people who have who
have a relationship with A and all those who A has a relationship. Given
that I also want to get the relationship id, the notes and the
relationshiptype, I''ve got something like this (sorry for all the
relatee and relation_tos, etc):
def allrelations
ar1 = self.relation_froms.find(:all, :include => :relator).collect
{|c| {"id" =>c.id, "notes" =>c.notes, "reltype" => c.reltype, "person&...