Module: BrighterPlanet::Flight::Relationships

Defined in:
lib/flight/relationships.rb

Class Method Summary collapse

Class Method Details

.included(target) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/flight/relationships.rb', line 4

def self.included(target)
  target.belongs_to :distance_class,      :class_name => 'FlightDistanceClass', :foreign_key => 'distance_class_name'
  target.belongs_to :fuel_type,                                                 :foreign_key => 'fuel_type_name'
  target.belongs_to :seat_class,          :class_name => 'FlightSeatClass',     :foreign_key => 'seat_class_name'
  target.belongs_to :country,                                                   :foreign_key => 'country_iso_3166_code'
  target.belongs_to :origin_airport,      :class_name => 'Airport',             :foreign_key => 'origin_airport_iata_code'
  target.belongs_to :destination_airport, :class_name => 'Airport',             :foreign_key => 'destination_airport_iata_code'
  target.belongs_to :aircraft,                                                  :foreign_key => 'aircraft_bp_code'
  target.belongs_to :aircraft_class,                                            :foreign_key => 'aircraft_class_code'
  target.belongs_to :airline,                                                   :foreign_key => 'airline_iata_code'
end