search for: warranty_id

Displaying 1 result from an estimated 1 matches for "warranty_id".

2006 Apr 07
4
belongs_to and lookup tables
...When I want the Warranty.company for a given Listing I want to say the following: @listing = Listing.find(4) @company = @listing.warranty.company In order to do that I did the following: class Listing < ActiveRecord::Base belongs_to :warranty end and of course my Listing table has a warranty_id column. This feels wrong. For one thing, it implies a parent-child relationship and implies that any Listings with a given Warranty can/should be deleted when a Warranty is deleted. Secondly, when I *do* delete a Warranty, my Listing''s warranty_id still points to the deleted record'...