lib/earth/air/flight_segment.rb in earth-0.12.3 vs lib/earth/air/flight_segment.rb in earth-0.12.4
- old
+ new
@@ -1,10 +1,23 @@
require 'earth/locality'
require 'fuzzy_match/cached_result'
class FlightSegment < ActiveRecord::Base
self.primary_key = "row_hash"
+
+ belongs_to :airline,
+ :primary_key => :bts_code,
+ :foreign_key => :airline_bts_code
+
+ belongs_to :origin_airport,
+ :class_name => 'Airport',
+ :primary_key => :iata_code,
+ :foreign_key => :origin_airport_iata_code
+ belongs_to :destination_airport,
+ :class_name => 'Airport',
+ :primary_key => :iata_code,
+ :foreign_key => :destination_airport_iata_code
# Cutting this for now because if iata code is missing we have to look up airports using both city and country; don't know how to do this with ActiveRecord
# - Ian 6/12/2011
# # If airport iata code is missing, associate with all airports in a city
# # We need this to calculate distance when importing ICAO segments - see cm1 flight_segment.rb
@@ -82,7 +95,7 @@
:airline_icao_code,
:load_factor,
:freight_share
)
- warn_unless_size 966913
+ warn_unless_size 1_254_412
end