My model is -
class TripLeg < ActiveRecord::Base belongs_to :airport, :foreign_key => :start_airport_id belongs_to :airport, :foreign_key => :end_airport_id belongs_to :trip has_many :trip_leg_passengers validates_presence_of :trip_id, :trip_id_sequence, :start_airport_id, :end_airport_id end
You'll notice the two foreign keys to airport, for the start and end point of the trip leg.
I now want to display the airport names on a view. I'd normally code -
trip_leg.airport.airport_city
but this doesn't work here.
How do I tell it to go from a specific column to airport ?
Thanks
Phil