Две модели ниже должны соединяться друг с другом двумя различными способами.Первый способ - HABTM .Второе - has_many и own_to.Таблица для модели GlossaryTerm имеет поле "main_video_id".Я знаю, что мне нужно настроить внешний ключ в моем объявлении принадлежащем.Как правильно установить отношение has_many в этой ситуации?
class GlossaryTerm < ActiveRecord::Base
has_and_belongs_to_many :videos
belongs_to :main_video, :class_name => "Video", :foreign_key => "main_video_id"
end
class Video < ActiveRecord::Base
has_and_belongs_to_many :glossary_terms
# unsure of this next line
has_many :main_glossary_terms, :class_name => "GlossaryTerm"
end