Forum: Ruby on Rails Table w/ 2 columns feat. the same foreign key (accessing?)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
699a58beef6ffecff73c02876e044c00?d=identicon&s=25 Bryan Haggerty (Guest)
on 2006-04-06 04:41
I have a database table named trips which has two columns (in addition
to others) which both have foreign keys to the locations table. The
columns are for a start location and an end location. The problem arises
in the trip model in trying to access each location.

belongs_to :location, :foreign_key => 'start_location_id' gives me
access to one of the locations but how can I access the other?

Thanks
This topic is locked and can not be replied to.