В чем разница между t.belongs_to и t.references в рельсах?
В чем разница междуt.references
а такжеt.belongs_to
? Почему у нас есть эти два разных слова? Мне кажется, они делают то же самое? Попробовал поиск в Google, но не нашел объяснения.
class CreateFoos < ActiveRecord::Migration
def change
create_table :foos do |t|
t.references :bar
t.belongs_to :baz
# The two above seems to give similar results
t.belongs_to :fooable, :polymorphic => true
# I have not tried polymorphic with t.references
t.timestamps
end
end
end