class Movie < ActiveRecord::Base
  
  belongs_to :director,
    class_name: "Actor",
    foreign_key: :director_id,
    primary_key: :id
  
  has_many :castings,
    class_name: "Casting",
    foreign_key: :movie_id,
    primary_key: :id
  
  has_many :actors,
    through: :castings,
    source: :actor

end
