From: Ira W. Snyder Date: Tue, 27 Nov 2007 07:42:19 +0000 (-0800) Subject: Fix BonusPurchase's Object Relationship X-Git-Tag: turned-in~4 X-Git-Url: https://irasnyder.com/gitweb/?a=commitdiff_plain;ds=inline;h=4bf27b6f7eb4a279d70e08c4c6ac38ad6ad829cf;p=cs356-p2-videostore.git Fix BonusPurchase's Object Relationship Signed-off-by: Ira W. Snyder --- 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 2dcc744..ead04f8 100644 Binary files a/db/development.sqlite3 and b/db/development.sqlite3 differ