From: Ira W. Snyder Date: Fri, 23 Nov 2007 00:30:22 +0000 (-0800) Subject: Revert "Add the has_many_polymorphs purchaseable model" X-Git-Tag: turned-in~59 X-Git-Url: https://www.irasnyder.com/gitweb/?p=cs356-p2-videostore.git;a=commitdiff_plain;h=ee21621dfb1f6679017ffdfb6be0cc1ca90f6638;hp=97d39268c0b348898dca1ec24552eb26a94ae546 Revert "Add the has_many_polymorphs purchaseable model" This reverts commit 97d39268c0b348898dca1ec24552eb26a94ae546. --- diff --git a/app/models/customer.rb b/app/models/customer.rb index 58db47d..901b9a5 100644 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -2,8 +2,6 @@ class Customer < ActiveRecord::Base has_many :coitems has_many :bitems - has_many_polymorphs :purchaseables, :from => [:coitems, :bitems], :through => :purchases - validates_presence_of :name, :email, :phone, :address validates_numericality_of :debt diff --git a/app/models/purchase.rb b/app/models/purchase.rb deleted file mode 100644 index 023f423..0000000 --- a/app/models/purchase.rb +++ /dev/null @@ -1,4 +0,0 @@ -class Purchase < ActiveRecord::Base - belongs_to :customer - belongs_to :purchaseable, :polymorphic => true -end diff --git a/db/development.sqlite3 b/db/development.sqlite3 index 2867aee..10e50e7 100644 Binary files a/db/development.sqlite3 and b/db/development.sqlite3 differ diff --git a/db/migrate/016_create_purchases.rb b/db/migrate/016_create_purchases.rb deleted file mode 100644 index 08bb7aa..0000000 --- a/db/migrate/016_create_purchases.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreatePurchases < ActiveRecord::Migration - def self.up - create_table :purchases do |t| - t.column :customer_id, :integer - t.column :purchaseable_id, :integer - t.column :purchaseable_type, :string - end - end - - def self.down - drop_table :purchases - end -end diff --git a/db/schema.rb b/db/schema.rb index b349a76..dcfe7d9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -2,7 +2,7 @@ # migrations feature of ActiveRecord to incrementally modify your database, and # then regenerate this schema definition. -ActiveRecord::Schema.define(:version => 16) do +ActiveRecord::Schema.define(:version => 15) do create_table "bitems", :force => true do |t| t.column "customer_id", :integer, :null => false @@ -35,12 +35,6 @@ ActiveRecord::Schema.define(:version => 16) do t.column "price", :decimal, :precision => 8, :scale => 2, :default => 0.0 end - create_table "purchases", :force => true do |t| - t.column "customer_id", :integer - t.column "purchaseable_id", :integer - t.column "purchaseable_type", :string - end - create_table "rentables", :force => true do |t| t.column "type", :string t.column "title", :string diff --git a/test/fixtures/purchases.yml b/test/fixtures/purchases.yml deleted file mode 100644 index b49c4eb..0000000 --- a/test/fixtures/purchases.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html -one: - id: 1 -two: - id: 2 diff --git a/test/unit/purchase_test.rb b/test/unit/purchase_test.rb deleted file mode 100644 index f9a5498..0000000 --- a/test/unit/purchase_test.rb +++ /dev/null @@ -1,10 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class PurchaseTest < Test::Unit::TestCase - fixtures :purchases - - # Replace this with your real tests. - def test_truth - assert true - end -end