Displaying 1 result from an estimated 1 matches for "referenced_by".
2006 Apr 07
4
belongs_to and lookup tables
I have two classes, Listing and Warranty. A Listing (think of it as a 
product) may or may not have a Warranty from a lookup table.
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