Wednesday 15 February 2012

ruby - Mapping a column of a table to different class using Rails -



ruby - Mapping a column of a table to different class using Rails -

is there way specify different table column?

for example, if there class "a" , class "b":

class has column called col , foreign key class b. class b not have foreign key a.

how can define class col of table maps id of table/class b?

rails belongs_to has foreign_key option:

class < activerecord::base belongs_to :b, :foreign_key => :col end

ruby-on-rails ruby activerecord

No comments:

Post a Comment