18 Active Record: The Basics 16 Active Support
bundle exec /home/rubys/git/rails/bin/rails new migration --skip-bundle --dev
create
create README
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/mailers
create app/models
create app/views/layouts/application.html.erb
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/environments
create config/environments/development.rb
create config/environments/production.rb
create config/environments/test.rb
create config/initializers
create config/initializers/backtrace_silencers.rb
create config/initializers/inflections.rb
create config/initializers/mime_types.rb
create config/initializers/secret_token.rb
create config/initializers/session_store.rb
create config/locales
create config/locales/en.yml
create config/boot.rb
create config/database.yml
create db
create db/seeds.rb
create doc
create doc/README_FOR_APP
create lib
create lib/tasks
create lib/tasks/.gitkeep
create log
create log/server.log
create log/production.log
create log/development.log
create log/test.log
create public
create public/404.html
create public/422.html
create public/500.html
create public/favicon.ico
create public/index.html
create public/robots.txt
create public/images
create public/images/rails.png
create public/stylesheets
create public/stylesheets/.gitkeep
create public/javascripts
create public/javascripts/application.js
create public/javascripts/controls.js
create public/javascripts/dragdrop.js
create public/javascripts/effects.js
create public/javascripts/prototype.js
create public/javascripts/rails.js
create script
create script/rails
create test
create test/fixtures
create test/functional
create test/integration
create test/performance/browsing_test.rb
create test/test_helper.rb
create test/unit
create tmp
create tmp/sessions
create tmp/sockets
create tmp/cache
create tmp/pids
create vendor/plugins
create vendor/plugins/.gitkeep
bundle install
Using rake (0.9.2.2)
Using abstract (1.0.0)
Using activesupport (3.0.15)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.15)
Using erubis (2.6.6)
Using rack (1.2.5)
Using rack-mount (0.6.14)
Using rack-test (0.5.7)
Using tzinfo (0.3.33)
Using actionpack (3.0.15)
Using mime-types (1.19)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.2.19)
Using actionmailer (3.0.15)
Using braintree (2.16.0)
Using activemerchant (1.10.0)
Using arel (2.0.10)
Using activerecord (3.0.15)
Using activeresource (3.0.15)
Using bundler (1.1.3)
Using highline (1.6.13)
Using net-ssh (2.5.2)
Using net-scp (1.0.4)
Using net-sftp (2.0.5)
Using net-ssh-gateway (1.1.0)
Using capistrano (2.12.0)
Using haml (3.1.6)
Using htmlentities (4.3.1)
Using json (1.7.3)
Using rdoc (3.12)
Using thor (0.14.6)
Using railties (3.0.15)
Using rails (3.0.15)
Using jquery-rails (0.2.7)
Using minitest (3.2.0)
Using mysql (2.8.1)
Using sqlite3 (1.3.6)
Using test-unit (2.5.0)
Using will_paginate (3.0.3)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
edit config/routes.rb
Migration::Application.routes.draw do
# ...
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
match ':controller(/:action(/:id(.:format)))'
end
cp -rpv /home/rubys/git/awdwr/edition3/plugins/* vendor/plugins/
`/home/rubys/git/awdwr/edition3/plugins/MANIFEST' -> `vendor/plugins/MANIFEST'
`/home/rubys/git/awdwr/edition3/plugins/acts_as_list' -> `vendor/plugins/acts_as_list'
`/home/rubys/git/awdwr/edition3/plugins/acts_as_list/test' -> `vendor/plugins/acts_as_list/test'
`/home/rubys/git/awdwr/edition3/plugins/acts_as_list/test/list_test.rb' -> `vendor/plugins/acts_as_list/test/list_test.rb'
`/home/rubys/git/awdwr/edition3/plugins/acts_as_list/init.rb' -> `vendor/plugins/acts_as_list/init.rb'
`/home/rubys/git/awdwr/edition3/plugins/acts_as_list/lib' -> `vendor/plugins/acts_as_list/lib'
`/home/rubys/git/awdwr/edition3/plugins/acts_as_list/lib/active_record' -> `vendor/plugins/acts_as_list/lib/active_record'
`/home/rubys/git/awdwr/edition3/plugins/acts_as_list/lib/active_record/acts' -> `vendor/plugins/acts_as_list/lib/active_record/acts'
`/home/rubys/git/awdwr/edition3/plugins/acts_as_list/lib/active_record/acts/list.rb' -> `vendor/plugins/acts_as_list/lib/active_record/acts/list.rb'
`/home/rubys/git/awdwr/edition3/plugins/acts_as_list/README' -> `vendor/plugins/acts_as_list/README'
`/home/rubys/git/awdwr/edition3/plugins/acts_as_tree' -> `vendor/plugins/acts_as_tree'
`/home/rubys/git/awdwr/edition3/plugins/acts_as_tree/test' -> `vendor/plugins/acts_as_tree/test'
`/home/rubys/git/awdwr/edition3/plugins/acts_as_tree/test/acts_as_tree_test.rb' -> `vendor/plugins/acts_as_tree/test/acts_as_tree_test.rb'
`/home/rubys/git/awdwr/edition3/plugins/acts_as_tree/test/fixtures' -> `vendor/plugins/acts_as_tree/test/fixtures'
`/home/rubys/git/awdwr/edition3/plugins/acts_as_tree/test/fixtures/mixin.rb' -> `vendor/plugins/acts_as_tree/test/fixtures/mixin.rb'
`/home/rubys/git/awdwr/edition3/plugins/acts_as_tree/test/fixtures/mixins.yml' -> `vendor/plugins/acts_as_tree/test/fixtures/mixins.yml'
`/home/rubys/git/awdwr/edition3/plugins/acts_as_tree/test/schema.rb' -> `vendor/plugins/acts_as_tree/test/schema.rb'
`/home/rubys/git/awdwr/edition3/plugins/acts_as_tree/test/abstract_unit.rb' -> `vendor/plugins/acts_as_tree/test/abstract_unit.rb'
`/home/rubys/git/awdwr/edition3/plugins/acts_as_tree/test/database.yml' -> `vendor/plugins/acts_as_tree/test/database.yml'
`/home/rubys/git/awdwr/edition3/plugins/acts_as_tree/init.rb' -> `vendor/plugins/acts_as_tree/init.rb'
`/home/rubys/git/awdwr/edition3/plugins/acts_as_tree/Rakefile' -> `vendor/plugins/acts_as_tree/Rakefile'
`/home/rubys/git/awdwr/edition3/plugins/acts_as_tree/lib' -> `vendor/plugins/acts_as_tree/lib'
`/home/rubys/git/awdwr/edition3/plugins/acts_as_tree/lib/active_record' -> `vendor/plugins/acts_as_tree/lib/active_record'
`/home/rubys/git/awdwr/edition3/plugins/acts_as_tree/lib/active_record/acts' -> `vendor/plugins/acts_as_tree/lib/active_record/acts'
`/home/rubys/git/awdwr/edition3/plugins/acts_as_tree/lib/active_record/acts/tree.rb' -> `vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb'
`/home/rubys/git/awdwr/edition3/plugins/acts_as_tree/README' -> `vendor/plugins/acts_as_tree/README'
`/home/rubys/git/awdwr/edition3/plugins/annotate_models' -> `vendor/plugins/annotate_models'
`/home/rubys/git/awdwr/edition3/plugins/annotate_models/ChangeLog' -> `vendor/plugins/annotate_models/ChangeLog'
`/home/rubys/git/awdwr/edition3/plugins/annotate_models/lib' -> `vendor/plugins/annotate_models/lib'
`/home/rubys/git/awdwr/edition3/plugins/annotate_models/lib/annotate_models.rb' -> `vendor/plugins/annotate_models/lib/annotate_models.rb'
`/home/rubys/git/awdwr/edition3/plugins/annotate_models/README' -> `vendor/plugins/annotate_models/README'
`/home/rubys/git/awdwr/edition3/plugins/annotate_models/tasks' -> `vendor/plugins/annotate_models/tasks'
`/home/rubys/git/awdwr/edition3/plugins/annotate_models/tasks/annotate_models_tasks.rake' -> `vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake'
`/home/rubys/git/awdwr/edition3/plugins/country_select' -> `vendor/plugins/country_select'
`/home/rubys/git/awdwr/edition3/plugins/country_select/install.rb' -> `vendor/plugins/country_select/install.rb'
`/home/rubys/git/awdwr/edition3/plugins/country_select/MIT-LICENSE' -> `vendor/plugins/country_select/MIT-LICENSE'
`/home/rubys/git/awdwr/edition3/plugins/country_select/init.rb' -> `vendor/plugins/country_select/init.rb'
`/home/rubys/git/awdwr/edition3/plugins/country_select/uninstall.rb' -> `vendor/plugins/country_select/uninstall.rb'
`/home/rubys/git/awdwr/edition3/plugins/country_select/lib' -> `vendor/plugins/country_select/lib'
`/home/rubys/git/awdwr/edition3/plugins/country_select/lib/country_select.rb' -> `vendor/plugins/country_select/lib/country_select.rb'
`/home/rubys/git/awdwr/edition3/plugins/country_select/README' -> `vendor/plugins/country_select/README'
cp -v -r ../depot/db/* db/
`../depot/db/development.sqlite3' -> `db/development.sqlite3'
`../depot/db/migrate' -> `db/migrate'
`../depot/db/migrate/20110711000004_add_sessions_table.rb' -> `db/migrate/20110711000004_add_sessions_table.rb'
`../depot/db/migrate/20110711000001_create_products.rb' -> `db/migrate/20110711000001_create_products.rb'
`../depot/db/migrate/20110711000002_add_price_to_product.rb' -> `db/migrate/20110711000002_add_price_to_product.rb'
`../depot/db/migrate/20110711000006_create_line_items.rb' -> `db/migrate/20110711000006_create_line_items.rb'
`../depot/db/migrate/20110711000007_create_users.rb' -> `db/migrate/20110711000007_create_users.rb'
`../depot/db/migrate/20110711000005_create_orders.rb' -> `db/migrate/20110711000005_create_orders.rb'
`../depot/db/migrate/20110711000003_add_test_data.rb' -> `db/migrate/20110711000003_add_test_data.rb'
`../depot/db/schema.rb' -> `db/schema.rb'
`../depot/db/seeds.rb' -> `db/seeds.rb'
`../depot/db/test.sqlite3' -> `db/test.sqlite3'
cp -v -r ../depot/app/models/* app/models/
`../depot/app/models/cart.rb' -> `app/models/cart.rb'
`../depot/app/models/cart_item.rb' -> `app/models/cart_item.rb'
`../depot/app/models/line_item.rb' -> `app/models/line_item.rb'
`../depot/app/models/order.rb' -> `app/models/order.rb'
`../depot/app/models/product.rb' -> `app/models/product.rb'
`../depot/app/models/user.rb' -> `app/models/user.rb'
rails generate model discount
invoke active_record
create db/migrate/20120629191620_create_discounts.rb
create app/models/discount.rb
invoke test_unit
create test/unit/discount_test.rb
create test/fixtures/discounts.yml
rails generate migration add_status_to_user status:string
invoke active_record
create db/migrate/20120629191625_add_status_to_user.rb
rake db:migrate
mv 20120629191620_create_discounts.rb 20110711000008_create_discounts.rb
mv 20120629191625_add_status_to_user.rb 20110711000009_add_status_to_user.rb
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
== CreateDiscounts: migrating ================================================
-- create_table(:discounts)
-> 0.0015s
== CreateDiscounts: migrated (0.0016s) =======================================
== AddStatusToUser: migrating ================================================
-- add_column(:users, :status, :string)
-> 0.0010s
== AddStatusToUser: migrated (0.0011s) =======================================
cp -v /home/rubys/git/awdwr/edition3/data/migrate/020* db/migrate
`/home/rubys/git/awdwr/edition3/data/migrate/020_add_email_to_orders.rb' -> `db/migrate/020_add_email_to_orders.rb'
rake db:migrate
mv 020_add_email_to_orders.rb 20110711000010_add_email_to_orders.rb
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
== AddEmailToOrders: migrating ===============================================
-- add_column(:orders, :e_mail, :string)
-> 0.0011s
== AddEmailToOrders: migrated (0.0012s) ======================================
rake annotate_models
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
Annotating LineItem
Skipping Cart
Annotating User
Annotating Order
Skipping CartItem
Annotating Discount
Annotating Product
cat app/models/line_item.rb
# == Schema Information
# Schema version: 20110711000010
#
# Table name: line_items
#
# id :integer not null, primary key
# product_id :integer not null
# order_id :integer not null
# quantity :integer not null
# total_price :decimal(8, 2) not null
# created_at :datetime
# updated_at :datetime
#
#START:belongs_to
class LineItem < ActiveRecord::Base
belongs_to :order
belongs_to :product
#END:belongs_to
def self.from_cart_item(cart_item)
li = self.new
li.product = cart_item.product
li.quantity = cart_item.quantity
li.total_price = cart_item.price
li
end
#START:belongs_to
end
#END:belongs_to
cp -v /home/rubys/git/awdwr/edition3/data/migrate/021* db/migrate
`/home/rubys/git/awdwr/edition3/data/migrate/021_add_placed_at_to_orders.rb' -> `db/migrate/021_add_placed_at_to_orders.rb'
rake db:migrate
mv 021_add_placed_at_to_orders.rb 20110711000011_add_placed_at_to_orders.rb
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
== AddPlacedAtToOrders: migrating ============================================
-- add_column(:orders, :placed_at, :datetime, {:default=>Fri Jun 29 15:16:43 -0400 2012})
-> 0.0077s
== AddPlacedAtToOrders: migrated (0.0078s) ===================================
rake annotate_models
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
Annotating LineItem
Skipping Cart
Annotating User
Annotating Order
Skipping CartItem
Annotating Discount
Annotating Product
cat app/models/line_item.rb
# == Schema Information
# Schema version: 20110711000011
#
# Table name: line_items
#
# id :integer not null, primary key
# product_id :integer not null
# order_id :integer not null
# quantity :integer not null
# total_price :decimal(8, 2) not null
# created_at :datetime
# updated_at :datetime
#
#START:belongs_to
class LineItem < ActiveRecord::Base
belongs_to :order
belongs_to :product
#END:belongs_to
def self.from_cart_item(cart_item)
li = self.new
li.product = cart_item.product
li.quantity = cart_item.quantity
li.total_price = cart_item.price
li
end
#START:belongs_to
end
#END:belongs_to
cp -v /home/rubys/git/awdwr/edition3/data/migrate/022* db/migrate
`/home/rubys/git/awdwr/edition3/data/migrate/022_add_columns_to_orders.rb' -> `db/migrate/022_add_columns_to_orders.rb'
rake db:migrate
mv 022_add_columns_to_orders.rb 20110711000012_add_columns_to_orders.rb
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
== AddColumnsToOrders: migrating =============================================
-- add_column(:orders, :attn, :string, {:limit=>100})
-> 0.0011s
-- add_column(:orders, :order_type, :integer)
-> 0.0007s
-- add_column(:orders, :ship_class, :string, {:null=>false, :default=>"priority"})
-> 0.0007s
-- add_column(:orders, :amount, :decimal, {:scale=>2, :precision=>8})
-> 0.0006s
-- add_column(:orders, :state, :string, {:limit=>2})
-> 0.0006s
== AddColumnsToOrders: migrated (0.0042s) ====================================
rake annotate_models
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
Annotating LineItem
Skipping Cart
Annotating User
Annotating Order
Skipping CartItem
Annotating Discount
Annotating Product
cat app/models/line_item.rb
# == Schema Information
# Schema version: 20110711000012
#
# Table name: line_items
#
# id :integer not null, primary key
# product_id :integer not null
# order_id :integer not null
# quantity :integer not null
# total_price :decimal(8, 2) not null
# created_at :datetime
# updated_at :datetime
#
#START:belongs_to
class LineItem < ActiveRecord::Base
belongs_to :order
belongs_to :product
#END:belongs_to
def self.from_cart_item(cart_item)
li = self.new
li.product = cart_item.product
li.quantity = cart_item.quantity
li.total_price = cart_item.price
li
end
#START:belongs_to
end
#END:belongs_to
cp -v /home/rubys/git/awdwr/edition3/data/migrate/023* db/migrate
`/home/rubys/git/awdwr/edition3/data/migrate/023_rename_email_column.rb' -> `db/migrate/023_rename_email_column.rb'
rake db:migrate
mv 023_rename_email_column.rb 20110711000013_rename_email_column.rb
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
== RenameEmailColumn: migrating ==============================================
-- rename_column(:orders, :e_mail, :customer_email)
-> 0.0210s
== RenameEmailColumn: migrated (0.0211s) =====================================
rake annotate_models
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
Annotating LineItem
Skipping Cart
Annotating User
Annotating Order
Skipping CartItem
Annotating Discount
Annotating Product
cat app/models/line_item.rb
# == Schema Information
# Schema version: 20110711000013
#
# Table name: line_items
#
# id :integer not null, primary key
# product_id :integer not null
# order_id :integer not null
# quantity :integer not null
# total_price :decimal(8, 2) not null
# created_at :datetime
# updated_at :datetime
#
#START:belongs_to
class LineItem < ActiveRecord::Base
belongs_to :order
belongs_to :product
#END:belongs_to
def self.from_cart_item(cart_item)
li = self.new
li.product = cart_item.product
li.quantity = cart_item.quantity
li.total_price = cart_item.price
li
end
#START:belongs_to
end
#END:belongs_to
cp -v /home/rubys/git/awdwr/edition3/data/migrate/024* db/migrate
`/home/rubys/git/awdwr/edition3/data/migrate/024_change_order_type_to_string.rb' -> `db/migrate/024_change_order_type_to_string.rb'
rake db:migrate
mv 024_change_order_type_to_string.rb 20110711000014_change_order_type_to_string.rb
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
== ChangeOrderTypeToString: migrating ========================================
-- change_column(:orders, :order_type, :string)
-> 0.0203s
== ChangeOrderTypeToString: migrated (0.0204s) ===============================
rake annotate_models
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
Annotating LineItem
Skipping Cart
Annotating User
Annotating Order
Skipping CartItem
Annotating Discount
Annotating Product
cat app/models/line_item.rb
# == Schema Information
# Schema version: 20110711000014
#
# Table name: line_items
#
# id :integer not null, primary key
# product_id :integer not null
# order_id :integer not null
# quantity :integer not null
# total_price :decimal(8, 2) not null
# created_at :datetime
# updated_at :datetime
#
#START:belongs_to
class LineItem < ActiveRecord::Base
belongs_to :order
belongs_to :product
#END:belongs_to
def self.from_cart_item(cart_item)
li = self.new
li.product = cart_item.product
li.quantity = cart_item.quantity
li.total_price = cart_item.price
li
end
#START:belongs_to
end
#END:belongs_to
cp -v /home/rubys/git/awdwr/edition3/data/migrate/025* db/migrate
`/home/rubys/git/awdwr/edition3/data/migrate/025_create_order_histories.rb' -> `db/migrate/025_create_order_histories.rb'
rake db:migrate
mv 025_create_order_histories.rb 20110711000015_create_order_histories.rb
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
== CreateOrderHistories: migrating ===========================================
-- create_table(:order_histories)
-> 0.0019s
== CreateOrderHistories: migrated (0.0020s) ==================================
rake annotate_models
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
Annotating LineItem
Skipping Cart
Annotating User
Annotating Order
Skipping CartItem
Annotating Discount
Annotating Product
cat app/models/line_item.rb
# == Schema Information
# Schema version: 20110711000015
#
# Table name: line_items
#
# id :integer not null, primary key
# product_id :integer not null
# order_id :integer not null
# quantity :integer not null
# total_price :decimal(8, 2) not null
# created_at :datetime
# updated_at :datetime
#
#START:belongs_to
class LineItem < ActiveRecord::Base
belongs_to :order
belongs_to :product
#END:belongs_to
def self.from_cart_item(cart_item)
li = self.new
li.product = cart_item.product
li.quantity = cart_item.quantity
li.total_price = cart_item.price
li
end
#START:belongs_to
end
#END:belongs_to
cp -v /home/rubys/git/awdwr/edition3/data/migrate/026* db/migrate
`/home/rubys/git/awdwr/edition3/data/migrate/026_create_table_tickets.rb' -> `db/migrate/026_create_table_tickets.rb'
rake db:migrate
mv 026_create_table_tickets.rb 20110711000016_create_table_tickets.rb
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
rake aborted!
An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: near "auto_increment": syntax error: CREATE TABLE "tickets" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "description" text, "text" text, "created_at" datetime, "updated_at" datetime) auto_increment = 10000
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
== CreateTableTickets: migrating =============================================
-- create_table(:tickets, {:options=>"auto_increment = 10000"})
rm db/migrate/20110711000016_create_table_tickets.rb
rake annotate_models
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
Annotating LineItem
Skipping Cart
Annotating User
Annotating Order
Skipping CartItem
Annotating Discount
Annotating Product
cat app/models/line_item.rb
# == Schema Information
# Schema version: 20110711000015
#
# Table name: line_items
#
# id :integer not null, primary key
# product_id :integer not null
# order_id :integer not null
# quantity :integer not null
# total_price :decimal(8, 2) not null
# created_at :datetime
# updated_at :datetime
#
#START:belongs_to
class LineItem < ActiveRecord::Base
belongs_to :order
belongs_to :product
#END:belongs_to
def self.from_cart_item(cart_item)
li = self.new
li.product = cart_item.product
li.quantity = cart_item.quantity
li.total_price = cart_item.price
li
end
#START:belongs_to
end
#END:belongs_to
cp -v /home/rubys/git/awdwr/edition3/data/migrate/027* db/migrate
`/home/rubys/git/awdwr/edition3/data/migrate/027_rename_order_histories.rb' -> `db/migrate/027_rename_order_histories.rb'
rake db:migrate
mv 027_rename_order_histories.rb 20110711000016_rename_order_histories.rb
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
== RenameOrderHistories: migrating ===========================================
-- rename_table(:order_histories, :order_notes)
-> 0.0010s
== RenameOrderHistories: migrated (0.0011s) ==================================
rake annotate_models
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
Annotating LineItem
Skipping Cart
Annotating User
Annotating Order
Skipping CartItem
Annotating Discount
Annotating Product
cat app/models/line_item.rb
# == Schema Information
# Schema version: 20110711000016
#
# Table name: line_items
#
# id :integer not null, primary key
# product_id :integer not null
# order_id :integer not null
# quantity :integer not null
# total_price :decimal(8, 2) not null
# created_at :datetime
# updated_at :datetime
#
#START:belongs_to
class LineItem < ActiveRecord::Base
belongs_to :order
belongs_to :product
#END:belongs_to
def self.from_cart_item(cart_item)
li = self.new
li.product = cart_item.product
li.quantity = cart_item.quantity
li.total_price = cart_item.price
li
end
#START:belongs_to
end
#END:belongs_to
cp -v /home/rubys/git/awdwr/edition3/data/migrate/028* db/migrate
`/home/rubys/git/awdwr/edition3/data/migrate/028_create_order_histories2.rb' -> `db/migrate/028_create_order_histories2.rb'
rake db:migrate
mv 028_create_order_histories2.rb 20110711000017_create_order_histories2.rb
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
== CreateOrderHistories2: migrating ==========================================
-- create_table(:order_histories)
-> 0.0017s
== CreateOrderHistories2: migrated (0.0326s) =================================
rake annotate_models
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
Annotating LineItem
Skipping Cart
Annotating User
Annotating Order
Skipping CartItem
Annotating Discount
Annotating Product
cat app/models/line_item.rb
# == Schema Information
# Schema version: 20110711000017
#
# Table name: line_items
#
# id :integer not null, primary key
# product_id :integer not null
# order_id :integer not null
# quantity :integer not null
# total_price :decimal(8, 2) not null
# created_at :datetime
# updated_at :datetime
#
#START:belongs_to
class LineItem < ActiveRecord::Base
belongs_to :order
belongs_to :product
#END:belongs_to
def self.from_cart_item(cart_item)
li = self.new
li.product = cart_item.product
li.quantity = cart_item.quantity
li.total_price = cart_item.price
li
end
#START:belongs_to
end
#END:belongs_to
cp -v /home/rubys/git/awdwr/edition3/data/migrate/029* db/migrate
`/home/rubys/git/awdwr/edition3/data/migrate/029_add_customer_name_index_to_orders.rb' -> `db/migrate/029_add_customer_name_index_to_orders.rb'
rake db:migrate
mv 029_add_customer_name_index_to_orders.rb 20110711000018_add_customer_name_index_to_orders.rb
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
== AddCustomerNameIndexToOrders: migrating ===================================
-- add_index(:orders, :name)
-> 0.0012s
== AddCustomerNameIndexToOrders: migrated (0.0013s) ==========================
rake annotate_models
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
Annotating LineItem
Skipping Cart
Annotating User
Annotating Order
Skipping CartItem
Annotating Discount
Annotating Product
cat app/models/line_item.rb
# == Schema Information
# Schema version: 20110711000018
#
# Table name: line_items
#
# id :integer not null, primary key
# product_id :integer not null
# order_id :integer not null
# quantity :integer not null
# total_price :decimal(8, 2) not null
# created_at :datetime
# updated_at :datetime
#
#START:belongs_to
class LineItem < ActiveRecord::Base
belongs_to :order
belongs_to :product
#END:belongs_to
def self.from_cart_item(cart_item)
li = self.new
li.product = cart_item.product
li.quantity = cart_item.quantity
li.total_price = cart_item.price
li
end
#START:belongs_to
end
#END:belongs_to
cp -v /home/rubys/git/awdwr/edition3/data/migrate/030* db/migrate
`/home/rubys/git/awdwr/edition3/data/migrate/030_create_author_book.rb' -> `db/migrate/030_create_author_book.rb'
rake db:migrate
mv 030_create_author_book.rb 20110711000019_create_author_book.rb
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
== CreateAuthorBook: migrating ===============================================
-- create_table(:authors_books, {:id=>false})
-> 0.0012s
== CreateAuthorBook: migrated (0.0013s) ======================================
rake annotate_models
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
Annotating LineItem
Skipping Cart
Annotating User
Annotating Order
Skipping CartItem
Annotating Discount
Annotating Product
cat app/models/line_item.rb
# == Schema Information
# Schema version: 20110711000019
#
# Table name: line_items
#
# id :integer not null, primary key
# product_id :integer not null
# order_id :integer not null
# quantity :integer not null
# total_price :decimal(8, 2) not null
# created_at :datetime
# updated_at :datetime
#
#START:belongs_to
class LineItem < ActiveRecord::Base
belongs_to :order
belongs_to :product
#END:belongs_to
def self.from_cart_item(cart_item)
li = self.new
li.product = cart_item.product
li.quantity = cart_item.quantity
li.total_price = cart_item.price
li
end
#START:belongs_to
end
#END:belongs_to
cp -v /home/rubys/git/awdwr/edition3/data/migrate/031* db/migrate
`/home/rubys/git/awdwr/edition3/data/migrate/031_create_table_tickets.rb' -> `db/migrate/031_create_table_tickets.rb'
rake db:migrate
mv 031_create_table_tickets.rb 20110711000020_create_table_tickets.rb
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
== CreateTableTickets: migrating =============================================
-- create_table(:tickets, {:primary_key=>:number})
-> 0.0014s
== CreateTableTickets: migrated (0.0015s) ====================================
rake annotate_models
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
Annotating LineItem
Skipping Cart
Annotating User
Annotating Order
Skipping CartItem
Annotating Discount
Annotating Product
cat app/models/line_item.rb
# == Schema Information
# Schema version: 20110711000020
#
# Table name: line_items
#
# id :integer not null, primary key
# product_id :integer not null
# order_id :integer not null
# quantity :integer not null
# total_price :decimal(8, 2) not null
# created_at :datetime
# updated_at :datetime
#
#START:belongs_to
class LineItem < ActiveRecord::Base
belongs_to :order
belongs_to :product
#END:belongs_to
def self.from_cart_item(cart_item)
li = self.new
li.product = cart_item.product
li.quantity = cart_item.quantity
li.total_price = cart_item.price
li
end
#START:belongs_to
end
#END:belongs_to
cp -v /home/rubys/git/awdwr/edition3/data/migrate/032* db/migrate
`/home/rubys/git/awdwr/edition3/data/migrate/032_test_discounts.rb' -> `db/migrate/032_test_discounts.rb'
rake db:migrate
mv 032_test_discounts.rb 20110711000021_test_discounts.rb
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
rake aborted!
An error has occurred, this and all later migrations canceled:
uninitialized constant TestDiscounts::Sku
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
== TestDiscounts: migrating ==================================================
== TestDiscounts: reverting ==================================================
== TestDiscounts: reverted (0.0038s) =========================================
rm db/migrate/20110711000021_test_discounts.rb
rake annotate_models
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
Annotating LineItem
Skipping Cart
Annotating User
Annotating Order
Skipping CartItem
Annotating Discount
Annotating Product
cat app/models/line_item.rb
# == Schema Information
# Schema version: 20110711000020
#
# Table name: line_items
#
# id :integer not null, primary key
# product_id :integer not null
# order_id :integer not null
# quantity :integer not null
# total_price :decimal(8, 2) not null
# created_at :datetime
# updated_at :datetime
#
#START:belongs_to
class LineItem < ActiveRecord::Base
belongs_to :order
belongs_to :product
#END:belongs_to
def self.from_cart_item(cart_item)
li = self.new
li.product = cart_item.product
li.quantity = cart_item.quantity
li.total_price = cart_item.price
li
end
#START:belongs_to
end
#END:belongs_to
mkdir db/migrate/dev_data
cp /home/rubys/git/awdwr/edition3/data/migrate/users.yml db/migrate/dev_data
rake db:migrate
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
rake annotate_models
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
Annotating LineItem
Skipping Cart
Annotating User
Annotating Order
Skipping CartItem
Annotating Discount
Annotating Product
cat app/models/line_item.rb
# == Schema Information
# Schema version: 20110711000020
#
# Table name: line_items
#
# id :integer not null, primary key
# product_id :integer not null
# order_id :integer not null
# quantity :integer not null
# total_price :decimal(8, 2) not null
# created_at :datetime
# updated_at :datetime
#
#START:belongs_to
class LineItem < ActiveRecord::Base
belongs_to :order
belongs_to :product
#END:belongs_to
def self.from_cart_item(cart_item)
li = self.new
li.product = cart_item.product
li.quantity = cart_item.quantity
li.total_price = cart_item.price
li
end
#START:belongs_to
end
#END:belongs_to
cp -v /home/rubys/git/awdwr/edition3/data/migrate/034* db/migrate
`/home/rubys/git/awdwr/edition3/data/migrate/034_load_user_data.rb' -> `db/migrate/034_load_user_data.rb'
rake db:migrate
mv 034_load_user_data.rb 20110711000021_load_user_data.rb
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
== LoadUserData: migrating ===================================================
== LoadUserData: reverting ===================================================
== LoadUserData: reverted (0.0153s) ==========================================
== LoadUserData: migrated (0.0290s) ==========================================
rake annotate_models
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
Annotating LineItem
Skipping Cart
Annotating User
Annotating Order
Skipping CartItem
Annotating Discount
Annotating Product
cat app/models/line_item.rb
# == Schema Information
# Schema version: 20110711000021
#
# Table name: line_items
#
# id :integer not null, primary key
# product_id :integer not null
# order_id :integer not null
# quantity :integer not null
# total_price :decimal(8, 2) not null
# created_at :datetime
# updated_at :datetime
#
#START:belongs_to
class LineItem < ActiveRecord::Base
belongs_to :order
belongs_to :product
#END:belongs_to
def self.from_cart_item(cart_item)
li = self.new
li.product = cart_item.product
li.quantity = cart_item.quantity
li.total_price = cart_item.price
li
end
#START:belongs_to
end
#END:belongs_to
cp -v /home/rubys/git/awdwr/edition3/data/migrate/035* db/migrate
`/home/rubys/git/awdwr/edition3/data/migrate/035_change_price_to_integer.rb' -> `db/migrate/035_change_price_to_integer.rb'
rake db:migrate
mv 035_change_price_to_integer.rb 20110711000022_change_price_to_integer.rb
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
== ChangePriceToInteger: migrating ===========================================
-- change_column(:line_items, :total_price, :integer)
-> 0.0160s
== ChangePriceToInteger: migrated (0.0239s) ==================================
rake annotate_models
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
Annotating LineItem
Skipping Cart
Annotating User
Annotating Order
Skipping CartItem
Annotating Discount
Annotating Product
cat app/models/line_item.rb
# == Schema Information
# Schema version: 20110711000022
#
# Table name: line_items
#
# id :integer not null, primary key
# product_id :integer not null
# order_id :integer not null
# quantity :integer not null
# total_price :integer not null
# created_at :datetime
# updated_at :datetime
#
#START:belongs_to
class LineItem < ActiveRecord::Base
belongs_to :order
belongs_to :product
#END:belongs_to
def self.from_cart_item(cart_item)
li = self.new
li.product = cart_item.product
li.quantity = cart_item.quantity
li.total_price = cart_item.price
li
end
#START:belongs_to
end
#END:belongs_to
cp -v /home/rubys/git/awdwr/edition3/data/migrate/036* db/migrate
`/home/rubys/git/awdwr/edition3/data/migrate/036_total_price_to_unit.rb' -> `db/migrate/036_total_price_to_unit.rb'
rake db:migrate
mv 036_total_price_to_unit.rb 20110711000023_total_price_to_unit.rb
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
== TotalPriceToUnit: migrating ===============================================
-- add_column(:line_items, :unit_price, :decimal, {:scale=>2, :precision=>8})
-> 0.0010s
== TotalPriceToUnit: migrated (0.0087s) ======================================
rake annotate_models
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
Annotating LineItem
Skipping Cart
Annotating User
Annotating Order
Skipping CartItem
Annotating Discount
Annotating Product
cat app/models/line_item.rb
# == Schema Information
# Schema version: 20110711000023
#
# Table name: line_items
#
# id :integer not null, primary key
# product_id :integer not null
# order_id :integer not null
# quantity :integer not null
# total_price :integer not null
# created_at :datetime
# updated_at :datetime
# unit_price :decimal(8, 2)
#
#START:belongs_to
class LineItem < ActiveRecord::Base
belongs_to :order
belongs_to :product
#END:belongs_to
def self.from_cart_item(cart_item)
li = self.new
li.product = cart_item.product
li.quantity = cart_item.quantity
li.total_price = cart_item.price
li
end
#START:belongs_to
end
#END:belongs_to
cp -v /home/rubys/git/awdwr/edition3/data/migrate/037* db/migrate
`/home/rubys/git/awdwr/edition3/data/migrate/037_add_foreign_key.rb' -> `db/migrate/037_add_foreign_key.rb'
cp -v /home/rubys/git/awdwr/edition3/data/migrate/migration_helpers.rb lib
`/home/rubys/git/awdwr/edition3/data/migrate/migration_helpers.rb' -> `lib/migration_helpers.rb'
rake db:migrate
mv 037_add_foreign_key.rb 20110711000024_add_foreign_key.rb
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
== AddForeignKey: migrating ==================================================
-- execute("\n CREATE TRIGGER fk_line_items_products_insert\n BEFORE INSERT ON line_items\n FOR EACH ROW BEGIN\n SELECT \n\t RAISE(ABORT, \"constraint violation: fk_line_items_products\")\n\tWHERE \n\t (SELECT id FROM products WHERE id = NEW.product_id) IS NULL;\n END;\n ")
-> 0.0009s
-- execute("\n CREATE TRIGGER fk_line_items_products_update\n BEFORE UPDATE ON line_items\n FOR EACH ROW BEGIN\n SELECT \n\t RAISE(ABORT, \"constraint violation: fk_line_items_products\")\n\tWHERE \n\t (SELECT id FROM products WHERE id = NEW.product_id) IS NULL;\n END;\n ")
-> 0.0004s
-- execute("\n CREATE TRIGGER fk_line_items_products_delete\n BEFORE DELETE ON products\n FOR EACH ROW BEGIN\n SELECT \n\t RAISE(ABORT, \"constraint violation: fk_line_items_products\")\n\tWHERE \n\t (SELECT id FROM line_items WHERE product_id = OLD.id) IS NOT NULL;\n END;\n ")
-> 0.0004s
-- execute("\n CREATE TRIGGER fk_line_items_orders_insert\n BEFORE INSERT ON line_items\n FOR EACH ROW BEGIN\n SELECT \n\t RAISE(ABORT, \"constraint violation: fk_line_items_orders\")\n\tWHERE \n\t (SELECT id FROM orders WHERE id = NEW.order_id) IS NULL;\n END;\n ")
-> 0.0003s
-- execute("\n CREATE TRIGGER fk_line_items_orders_update\n BEFORE UPDATE ON line_items\n FOR EACH ROW BEGIN\n SELECT \n\t RAISE(ABORT, \"constraint violation: fk_line_items_orders\")\n\tWHERE \n\t (SELECT id FROM orders WHERE id = NEW.order_id) IS NULL;\n END;\n ")
-> 0.0003s
-- execute("\n CREATE TRIGGER fk_line_items_orders_delete\n BEFORE DELETE ON orders\n FOR EACH ROW BEGIN\n SELECT \n\t RAISE(ABORT, \"constraint violation: fk_line_items_orders\")\n\tWHERE \n\t (SELECT id FROM line_items WHERE order_id = OLD.id) IS NOT NULL;\n END;\n ")
-> 0.0003s
== AddForeignKey: migrated (0.0031s) =========================================
rake annotate_models
DEPRECATION WARNING: Rake tasks in /home/rubys/git/awdwr/edition3/work-30/migration/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake are deprecated. Use lib/tasks instead. (called from /home/rubys/git/awdwr/edition3/work-30/migration/Rakefile:7)
Annotating LineItem
Skipping Cart
Annotating User
Annotating Order
Skipping CartItem
Annotating Discount
Annotating Product
cat app/models/line_item.rb
# == Schema Information
# Schema version: 20110711000024
#
# Table name: line_items
#
# id :integer not null, primary key
# product_id :integer not null
# order_id :integer not null
# quantity :integer not null
# total_price :integer not null
# created_at :datetime
# updated_at :datetime
# unit_price :decimal(8, 2)
#
#START:belongs_to
class LineItem < ActiveRecord::Base
belongs_to :order
belongs_to :product
#END:belongs_to
def self.from_cart_item(cart_item)
li = self.new
li.product = cart_item.product
li.quantity = cart_item.quantity
li.total_price = cart_item.price
li
end
#START:belongs_to
end
#END:belongs_to