shared items

Friday, October 12, 2012

ROR: Multiple references to the same table in the parent table

class Address < ActiveRecord::Base
  has_many :customersend
 
class Customer < ActiveRecord::Base
  belongs_to :billing_address, :class_name => 'Address', :foreign_key => 'billing_address_id'
  belongs_to :shipping_address, :class_name => 'Address', :foreign_key => 'shipping_address_id'
end


Source : Linky

No comments: