Permalink
Browse files

made some database schema changes (I spelled the some column names wr…

…ong)
  • Loading branch information...
1 parent 1fc99e8 commit 4e0b942b4a1b5a7f5da9a66c3ee5ab582b5d6be7 @florida committed Nov 9, 2012
Showing with 28 additions and 6 deletions.
  1. +18 −0 .project
  2. +2 −0 app/models/lineitem.rb
  3. +1 −0 app/models/order.rb
  4. +1 −0 app/models/product.rb
  5. +2 −2 db/migrate/20121108232607_create_lineitems.rb
  6. +4 −4 db/schema.rb
View
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>ecomm_store</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.aptana.ide.core.unifiedBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.radrails.rails.core.railsnature</nature>
+ <nature>com.aptana.ruby.core.rubynature</nature>
+ </natures>
+</projectDescription>
View
@@ -1,3 +1,5 @@
class Lineitem < ActiveRecord::Base
attr_accessible :order_id, :product_id, :quantity, :unit_price
+ belongs_to :product
+ belongs_to :order
end
View
@@ -1,3 +1,4 @@
class Order < ActiveRecord::Base
attr_accessible :address, :email, :first_name, :last_name
+ has_many :lineitems
end
View
@@ -1,3 +1,4 @@
class Product < ActiveRecord::Base
attr_accessible :description, :name, :price, :stock_no
+ has_many :lineitems
end
@@ -1,8 +1,8 @@
class CreateLineitems < ActiveRecord::Migration
def change
create_table :lineitems do |t|
- t.references :product_id
- t.references :order_id
+ t.references :product
+ t.references :order
t.integer :quantity
t.float :unit_price
View
@@ -14,12 +14,12 @@
ActiveRecord::Schema.define(:version => 20121108232840) do
create_table "lineitems", :force => true do |t|
- t.integer "product_id_id"
- t.integer "order_id_id"
+ t.integer "product_id"
+ t.integer "order_id"
t.integer "quantity"
t.float "unit_price"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
create_table "orders", :force => true do |t|

0 comments on commit 4e0b942

Please sign in to comment.