activerecord custom foreign key code example Example: activerecord references foreign key t.references :user, foreign_key: true