From 4bf27b6f7eb4a279d70e08c4c6ac38ad6ad829cf Mon Sep 17 00:00:00 2001 From: "Ira W. Snyder" Date: Mon, 26 Nov 2007 23:42:19 -0800 Subject: [PATCH] Fix BonusPurchase's Object Relationship Signed-off-by: Ira W. Snyder --- app/models/bonus_purchase.rb | 2 +- app/models/rentable.rb | 1 + db/development.sqlite3 | Bin 37888 -> 37888 bytes 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/bonus_purchase.rb b/app/models/bonus_purchase.rb index 36f7d9b..a0d8a5c 100644 --- a/app/models/bonus_purchase.rb +++ b/app/models/bonus_purchase.rb @@ -18,7 +18,7 @@ class BonusPurchase < Purchase # Unable to find a last bonus, no bonuses in period return since_date end - + protected def validate errors.add(:rentable_id, "is not in the database") if rentable.nil? diff --git a/app/models/rentable.rb b/app/models/rentable.rb index e52af25..2905aed 100644 --- a/app/models/rentable.rb +++ b/app/models/rentable.rb @@ -1,6 +1,7 @@ class Rentable < ActiveRecord::Base has_many :coitems has_many :rentable_purchases + has_many :bonus_purchases validates_presence_of :title # don't validate newrelease, false is ok diff --git a/db/development.sqlite3 b/db/development.sqlite3 index 2dcc744dbc3ff314c57140a464b2b8d1e57e1b27..ead04f874d74c221ada73b1426c554307054c55b 100644 GIT binary patch delta 169 zcmZoz!PKyVX@WFk%to1~+$;?-4Q91Q`^kdss*GHl J{U>c?1OUDMC*uGB delta 120 zcmZoz!PKyVX@WFk#73E?+$_v`3?h?Rd9*nga~N}&>=+FuHvZUb!26Gph4~1B+~hU9 z(vyAp%efdB7~~ik6%`pdCSTwcGnX|w;Njf?;n1|9kU -- 2.34.1