Displaying 1 result from an estimated 1 matches for "shipfromaddress".
Did you mean:
ship_from_address
2006 Jun 06
1
Please Help with single table inheritance relationships
...column ''type'' :string
..
end
# Generated model from rails'' scaffolding
class Address < ActiveRecord::Base
end
# Manually added these 3 classes
class ShippingAddress < Address
belongs_to :person
end
class BillingAddress < Address
belongs_to :person
end
class ShipFromAddress < Address
belongs_to :retailer
def retailer_id= (input)
person_id = input;
end
def retailer_id
person_id
end
end
# Made these changes:
class Person < ActiveRecord::Base
has_one :shipping_address
has_one :billing_address
end
class Retailer < ActiveRecord::Base
has_on...