Revert "Add the has_many_polymorphs purchaseable model"
authorIra W. Snyder <devel@irasnyder.com>
Fri, 23 Nov 2007 00:30:22 +0000 (16:30 -0800)
committerIra W. Snyder <devel@irasnyder.com>
Fri, 23 Nov 2007 00:30:22 +0000 (16:30 -0800)
This reverts commit 97d39268c0b348898dca1ec24552eb26a94ae546.

app/models/customer.rb
app/models/purchase.rb [deleted file]
db/development.sqlite3
db/migrate/016_create_purchases.rb [deleted file]
db/schema.rb
test/fixtures/purchases.yml [deleted file]
test/unit/purchase_test.rb [deleted file]

index 58db47d..901b9a5 100644 (file)
@@ -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 (file)
index 023f423..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-class Purchase < ActiveRecord::Base
-  belongs_to :customer
-  belongs_to :purchaseable, :polymorphic => true
-end
index 2867aee..10e50e7 100644 (file)
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 (file)
index 08bb7aa..0000000
+++ /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
index b349a76..dcfe7d9 100644 (file)
@@ -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 (file)
index b49c4eb..0000000
+++ /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 (file)
index f9a5498..0000000
+++ /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