Bryan Haggerty
2006-Apr-06 02:41 UTC
[Rails] Table w/ 2 columns feat. the same foreign key (accessing?)
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 -- Posted via http://www.ruby-forum.com/.
Apparently Analagous Threads
- belongs_to with foreign keys that reference non primary key columns
- Foreign Key naming convention override
- Deleting from a 'has_many' collection doesn't set the foreign key to NULL
- has_many :through and foreign key parameters
- cant map foreign key in list view