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
+++ /dev/null
-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
# 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
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
+++ /dev/null
-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