Rails migration: t.references with alternative name?

Posted by marienbad on Stack Overflow See other posts from Stack Overflow or by marienbad
Published on 2010-05-29T02:57:15Z Indexed on 2010/05/29 3:02 UTC
Read the original article Hit count: 335

Filed under:
|
|

So I have a create_table like this for Courses at a School:

create_table :courses do |t|
  t.string :name
  t.references :course
  t.timestamps
end

but I want it to reference TWO other courses like:

has_many :transferrable_as #a Course

has_many :same_as #another Course

can I say

t.references :transferrable_as, :as=> :course

?

© Stack Overflow or respective owner

Related posts about associations

Related posts about migrations