From 45912d5d7593197bb7d615bcff8d342fdca45e66 Mon Sep 17 00:00:00 2001 From: Alex Coles Date: Tue, 6 May 2008 14:22:31 +0200 Subject: [PATCH] Fixed one-to-one associations * Added explicit association key for all one-to-one assocations. --- app/models/accounts/base_account.rb | 3 ++- app/models/order.rb | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/models/accounts/base_account.rb b/app/models/accounts/base_account.rb index 789cca0..cf9bd21 100644 --- a/app/models/accounts/base_account.rb +++ b/app/models/accounts/base_account.rb @@ -8,9 +8,10 @@ module Accounts require 'ezcrypto' property :type, Class # single-table inheritance + property :order_id, Fixnum # foreign-key property :customer_id, Fixnum # foreign-key - one_to_one :order + one_to_one :order many_to_one :customer #, :accessor => :protected end diff --git a/app/models/order.rb b/app/models/order.rb index 127deb2..dde12a4 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -14,6 +14,8 @@ class Order property :product_cost, Float, :default => 0.0 property :shipping_cost, Float, :default => 0.0 property :tax, Float, :default => 0.0, :nullable => false + property :billing_address_id, Fixnum # foreign-key + property :shipping_address_id, Fixnum # foreign-key property :account_id, Fixnum # foreign-key property :customer_id, Fixnum # foreign-key property :order_shipping_type_id, Fixnum # foreign-key -- 2.11.4.GIT