Displaying 1 result from an estimated 1 matches for "dbdict".
Did you mean:
libdict
2006 Apr 17
0
polymorphic association with single model as target
...ed
like this:
belongs_to :ref, :polymorphic => true
I use the ref_id as foreign key (as in all the examples) and ref_type as
INTEGER with a number defining the dictionary I''d like to refer too.
Doing the "joins" myself as in the exemple below works well.
@marks_en = DbDict.find(:all,
:target => DBDICT_EN_TYPE,
:joins => "as db inner join marks as ma on ma.ref_id =
db.id",
:conditions => "ma.ref_type = " + DBDICT_EN_TYPE.to_s)
Doing a call to something like:
@mark = Mark.find(params[:id])...