19 ActiveRecord: Relationships Between Tables 17 Migration
<"=> [\"id\", \"name\", \"address\", \"email\", \"pay_type\", \"created_at\", \"updated_at\", \"customer_email\", \"placed_at\", \"attn\", \"order_type\", \"ship_class\", \"amount\", \"state\"]"> expected but was <"ActiveRecord::StatementInvalid: Could not find table 'orders'">. Traceback: /home/rubys/git/awdwr/edition3/checkdepot.rb:291:in `block in <class:DepotTest>'
echo "Order.column_names" | IRBRC=tmp/irbrc ruby script/console
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties/lib/rails/gem_dependency.rb:21.
NOTE: Gem::SourceIndex#initialize is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#initialize called from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:100.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties/lib/rails/gem_dependency.rb:21.
NOTE: Gem::SourceIndex#initialize is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#initialize called from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:100.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
Switch to inspect mode.
>> Order.column_names
ActiveRecord::StatementInvalid: Could not find table 'orders'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `block in table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1318:in `column_names'
from (irb):1
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>>
echo "Order.columns_hash[\"pay_type\"]" | IRBRC=tmp/irbrc ruby script/console
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties/lib/rails/gem_dependency.rb:21.
NOTE: Gem::SourceIndex#initialize is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#initialize called from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:100.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties/lib/rails/gem_dependency.rb:21.
NOTE: Gem::SourceIndex#initialize is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#initialize called from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:100.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
Switch to inspect mode.
>> Order.columns_hash["pay_type"]
ActiveRecord::StatementInvalid: Could not find table 'orders'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `block in table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1313:in `columns_hash'
from (irb):1
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>>
sqlite3> select * from orders limit 1
Error: no such table: orders
echo "Product.find(:first).updated_at_before_type_cast" | IRBRC=tmp/irbrc ruby script/console
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties/lib/rails/gem_dependency.rb:21.
NOTE: Gem::SourceIndex#initialize is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#initialize called from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:100.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties/lib/rails/gem_dependency.rb:21.
NOTE: Gem::SourceIndex#initialize is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#initialize called from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:100.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
Switch to inspect mode.
>> Product.find(:first).updated_at_before_type_cast
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: products: SELECT * FROM "products" LIMIT 1
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `rescue in log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:204:in `log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `block in execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:418:in `catch_schema_changes'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:321:in `select'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all_with_query_cache'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:665:in `find_by_sql'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1582:in `find_every'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1539:in `find_initial'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:617:in `find'
from (irb):1
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>>
irb e1/ar/new_examples.rb
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties/lib/rails/gem_dependency.rb:21.
NOTE: Gem::SourceIndex#initialize is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#initialize called from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:100.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Switch to inspect mode.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
>> $: << File.dirname(__FILE__)
=> ["/home/rubys/git/awdwr/edition3/work-192-23/migration/app/controllers/", "/home/rubys/git/awdwr/edition3/work-192-23/migration/app", "/home/rubys/git/awdwr/edition3/work-192-23/migration/app/models", "/home/rubys/git/awdwr/edition3/work-192-23/migration/app/controllers", "/home/rubys/git/awdwr/edition3/work-192-23/migration/app/helpers", "/home/rubys/git/awdwr/edition3/work-192-23/migration/lib", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties/lib/../builtin/rails_info/", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties/lib", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activesupport/lib", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/actionpack/lib", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/actionmailer/lib", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activeresource/lib", "/home/rubys/git/gorp/lib", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/x86_64-linux", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/vendor_ruby/1.9.1", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/vendor_ruby/1.9.1/x86_64-linux", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/vendor_ruby", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/x86_64-linux", "/home/rubys/git/awdwr/edition3/data/code/e1/ar"]
>> require "connect"
=> true
?> require "rubygems"
=> []
>> require "active_record"
=> []
>> class Order < ActiveRecord::Base
>> end
=> nil
?> an_order = Order.new
ActiveRecord::StatementInvalid: Could not find table 'orders'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `block in table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:3067:in `attributes_from_column_definition'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/locking/optimistic.rb:66:in `attributes_from_column_definition_with_lock'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2473:in `initialize'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/new_examples.rb:12:in `new'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/new_examples.rb:12
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> an_order.name = "Dave Thomas"
NoMethodError: undefined method `name=' for nil:NilClass
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activesupport/lib/active_support/whiny_nil.rb:52:in `method_missing'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/new_examples.rb:13
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> an_order.email = "dave@example.com"
NoMethodError: undefined method `email=' for nil:NilClass
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activesupport/lib/active_support/whiny_nil.rb:52:in `method_missing'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/new_examples.rb:14
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> an_order.address = "123 Main St"
NoMethodError: undefined method `address=' for nil:NilClass
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activesupport/lib/active_support/whiny_nil.rb:52:in `method_missing'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/new_examples.rb:15
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> an_order.pay_type = "check"
NoMethodError: undefined method `pay_type=' for nil:NilClass
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activesupport/lib/active_support/whiny_nil.rb:52:in `method_missing'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/new_examples.rb:16
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> an_order.save
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.save
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/new_examples.rb:17
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
?> Order.new do |o|
?> o.name = "Dave Thomas"
>> # . . .
?> o.save
>> end
ActiveRecord::StatementInvalid: Could not find table 'orders'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `block in table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:3067:in `attributes_from_column_definition'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/locking/optimistic.rb:66:in `attributes_from_column_definition_with_lock'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2473:in `initialize'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/new_examples.rb:21:in `new'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/new_examples.rb:21
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
?> an_order = Order.new(
?> :name => "Dave Thomas",
?> :email => "dave@example.com",
?> :address => "123 Main St",
?> :pay_type => "check")
ActiveRecord::StatementInvalid: Could not find table 'orders'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `block in table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:3067:in `attributes_from_column_definition'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/locking/optimistic.rb:66:in `attributes_from_column_definition_with_lock'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2473:in `initialize'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/new_examples.rb:29:in `new'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/new_examples.rb:29
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> an_order.save
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.save
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/new_examples.rb:34
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
?> an_order = Order.new
ActiveRecord::StatementInvalid: Could not find table 'orders'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `block in table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:3067:in `attributes_from_column_definition'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/locking/optimistic.rb:66:in `attributes_from_column_definition_with_lock'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2473:in `initialize'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/new_examples.rb:38:in `new'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/new_examples.rb:38
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> an_order.name = "Dave Thomas"
NoMethodError: undefined method `name=' for nil:NilClass
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activesupport/lib/active_support/whiny_nil.rb:52:in `method_missing'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/new_examples.rb:39
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> # ...
?> an_order.save
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.save
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/new_examples.rb:41
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> puts "The ID of this order is #{an_order.id}"
RuntimeError: Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/new_examples.rb:42
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
?> an_order = Order.create(
?> :name => "Dave Thomas",
?> :email => "dave@example.com",
?> :address => "123 Main St",
?> :pay_type => "check")
ActiveRecord::StatementInvalid: Could not find table 'orders'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `block in table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:3067:in `attributes_from_column_definition'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/locking/optimistic.rb:66:in `attributes_from_column_definition_with_lock'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2473:in `initialize'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:725:in `new'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:725:in `create'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/new_examples.rb:46
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
?> orders = Order.create(
?> [ { :name => "Dave Thomas",
?> :email => "dave@example.com",
?> :address => "123 Main St",
?> :pay_type => "check"
>> },
?> { :name => "Andy Hunt",
?> :email => "andy@example.com",
?> :address => "456 Gentle Drive",
?> :pay_type => "po"
>> } ] )
ActiveRecord::StatementInvalid: Could not find table 'orders'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `block in table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:3067:in `attributes_from_column_definition'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/locking/optimistic.rb:66:in `attributes_from_column_definition_with_lock'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2473:in `initialize'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:725:in `new'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:725:in `create'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:723:in `block in create'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:723:in `collect'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:723:in `create'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/new_examples.rb:54
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
=> nil
irb e1/ar/find_examples.rb
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties/lib/rails/gem_dependency.rb:21.
NOTE: Gem::SourceIndex#initialize is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#initialize called from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:100.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
Switch to inspect mode.
>> $: << File.dirname(__FILE__)
=> ["/home/rubys/git/awdwr/edition3/work-192-23/migration/app/controllers/", "/home/rubys/git/awdwr/edition3/work-192-23/migration/app", "/home/rubys/git/awdwr/edition3/work-192-23/migration/app/models", "/home/rubys/git/awdwr/edition3/work-192-23/migration/app/controllers", "/home/rubys/git/awdwr/edition3/work-192-23/migration/app/helpers", "/home/rubys/git/awdwr/edition3/work-192-23/migration/lib", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties/lib/../builtin/rails_info/", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties/lib", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activesupport/lib", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/actionpack/lib", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/actionmailer/lib", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activeresource/lib", "/home/rubys/git/gorp/lib", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/x86_64-linux", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/vendor_ruby/1.9.1", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/vendor_ruby/1.9.1/x86_64-linux", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/vendor_ruby", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/x86_64-linux", "/home/rubys/git/awdwr/edition3/data/code/e1/ar"]
>> require "connect"
=> true
>> require "logger"
=> []
>> ActiveRecord::Base.logger = Logger.new(STDERR)
=> #<Logger:0x00000002fb5f98 @progname=nil, @level=0, @default_formatter=#<Logger::Formatter:0x00000002fb5f70 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x00000002fb5f20 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x00000002fb5ef8 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x00000002fb5ea8>>>>
?> require "rubygems"
=> []
>> require "active_record"
=> []
>> require "pp"
=> ["PP"]
>> @params = {}
=> {}
>> def params
>> @params
>> end
=> nil
?> class Order < ActiveRecord::Base
>> named_scope :check, :conditions => {:pay_type => 'check'}
>> named_scope :cc, :conditions => {:pay_type => 'cc'}
>> named_scope :po, :conditions => {:pay_type => 'po'}
>> end
=> #<Proc:0x00000002a7c4a0@/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:102 (lambda)>
?> class Order < ActiveRecord::Base
>> named_scope :recent, :conditions => ['created_at > ?', 1.week.ago]
>> named_scope :since, lambda { |range|
?> { :conditions => ['created_at > ?', range] }
>> }
>> end
=> #<Proc:0x00000002582328@/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:102 (lambda)>
>> class LineItem < ActiveRecord::Base
>> end
=> nil
>> class Product < ActiveRecord::Base
>> end
=> nil
?> # return an arbitrary order
?> order = Order.find(:first)
Order Load (0.0ms) SQLite3::SQLException: no such table: orders: SELECT * FROM "orders" LIMIT 1
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: orders: SELECT * FROM "orders" LIMIT 1
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `rescue in log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:204:in `log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `block in execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:418:in `catch_schema_changes'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:321:in `select'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all_with_query_cache'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:665:in `find_by_sql'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1582:in `find_every'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1539:in `find_initial'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:617:in `find'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:42
Order Load (0.0ms) SQLite3::SQLException: no such table: orders: SELECT * FROM "orders" WHERE (name = 'Dave Thomas') LIMIT 1
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> # return an order for Dave
?> order = Order.find(:first, :conditions => "name = 'Dave Thomas'")
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: orders: SELECT * FROM "orders" WHERE (name = 'Dave Thomas') LIMIT 1
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `rescue in log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:204:in `log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `block in execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:418:in `catch_schema_changes'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:321:in `select'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all_with_query_cache'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:665:in `find_by_sql'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1582:in `find_every'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1539:in `find_initial'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:617:in `find'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:45
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> # return the latest order for Dave
?> order = Order.find(:first,
?> :conditions => "name = 'Dave Thomas'",
Order Load (0.0ms) SQLite3::SQLException: no such table: orders: SELECT * FROM "orders" WHERE (name = 'Dave Thomas') ORDER BY id DESC LIMIT 1
?> :order => "id DESC")
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: orders: SELECT * FROM "orders" WHERE (name = 'Dave Thomas') ORDER BY id DESC LIMIT 1
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `rescue in log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:204:in `log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `block in execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:418:in `catch_schema_changes'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:321:in `select'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all_with_query_cache'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:665:in `find_by_sql'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1582:in `find_every'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1539:in `find_initial'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:617:in `find'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:48
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
?> orders = LineItem.find_by_sql("select line_items.* from line_items, orders " +
?> " where order_id = orders.id " +
?> " and orders.name = 'Dave Thomas' ")
LineItem Load (0.0ms) SQLite3::SQLException: no such table: line_items: select line_items.* from line_items, orders where order_id = orders.id and orders.name = 'Dave Thomas'
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: line_items: select line_items.* from line_items, orders where order_id = orders.id and orders.name = 'Dave Thomas'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `rescue in log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:204:in `log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `block in execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:418:in `catch_schema_changes'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:321:in `select'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all_with_query_cache'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:665:in `find_by_sql'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:54
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
Order Load (0.0ms) SQLite3::SQLException: no such table: orders: select name, pay_type from orders
?> orders = Order.find_by_sql("select name, pay_type from orders")
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: orders: select name, pay_type from orders
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `rescue in log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:204:in `log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `block in execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:418:in `catch_schema_changes'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:321:in `select'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all_with_query_cache'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:665:in `find_by_sql'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:61
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> first = orders[0]
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:63
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> p first.attributes
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.attributes
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:64
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> p first.attribute_names
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.attribute_names
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:65
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> p first.attribute_present?("address")
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.attribute_present?
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:66
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
?> p Order.all
Order Load (0.0ms) SQLite3::SQLException: no such table: orders: SELECT * FROM "orders"
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: orders: SELECT * FROM "orders"
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `rescue in log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:204:in `log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `block in execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:418:in `catch_schema_changes'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:321:in `select'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all_with_query_cache'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:665:in `find_by_sql'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1582:in `find_every'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:619:in `find'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:639:in `all'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:71
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> p Order.check(:order => "created_on desc").first
Order Load (0.0ms) SQLite3::SQLException: no such table: orders: SELECT * FROM "orders" WHERE ("orders"."pay_type" = 'check') LIMIT 1
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: orders: SELECT * FROM "orders" WHERE ("orders"."pay_type" = 'check') LIMIT 1
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `rescue in log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:204:in `log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `block in execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:418:in `catch_schema_changes'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:321:in `select'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all_with_query_cache'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:665:in `find_by_sql'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1582:in `find_every'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1539:in `find_initial'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:617:in `find'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:186:in `block in method_missing'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2182:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:179:in `method_missing'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:137:in `first'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:72
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'>> p Order.po.recent.count
ActiveRecord::StatementInvalid: Could not find table 'orders'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `block in table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/calculations.rb:300:in `column_for'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/calculations.rb:129:in `calculate'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/calculations.rb:48:in `count'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:186:in `block in method_missing'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2182:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:179:in `method_missing'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:186:in `block in method_missing'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2182:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:179:in `method_missing'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:73
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'>> p Order.check.find_by_name('Dave Thomas')
Order Load (0.0ms) SQLite3::SQLException: no such table: orders: SELECT * FROM "orders" WHERE ((created_at > '2012-12-10 14:17:07') AND ("orders"."pay_type" = 'po'))
ActiveRecord::StatementInvalid: Could not find table 'orders'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `block in table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1318:in `column_names'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1331:in `column_methods_hash'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `block in all_attributes_exists?'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `each'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `all?'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `all_attributes_exists?'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1876:in `method_missing'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:186:in `block in method_missing'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2182:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:179:in `method_missing'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:74
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'>> #END:pay_scopes
?> p Order.po.recent(:order => :created_at).to_a
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: orders: SELECT * FROM "orders" WHERE ((created_at > '2012-12-10 14:17:07') AND ("orders"."pay_type" = 'po'))
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `rescue in log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:204:in `log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `block in execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:418:in `catch_schema_changes'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
Order Load (0.0ms) SQLite3::SQLException: no such table: orders: SELECT * FROM "orders" WHERE ((created_at > '2012-12-10 14:17:07') AND ("orders"."pay_type" = 'po'))
LineItem Delete all (0.0ms) SQLite3::SQLException: no such table: line_items: DELETE FROM "line_items" WHERE 1=1
Product Delete all (0.0ms) SQLite3::SQLException: no such table: products: DELETE FROM "products" WHERE 1=1
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:321:in `select'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all_with_query_cache'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:665:in `find_by_sql'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1582:in `find_every'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:619:in `find'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:186:in `block in method_missing'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2182:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:179:in `method_missing'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:186:in `block in method_missing'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2182:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:179:in `method_missing'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:193:in `load_found'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:171:in `proxy_found'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:114:in `to_a'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:78
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'>> p Order.po.since(1.week.ago).to_a
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: orders: SELECT * FROM "orders" WHERE ((created_at > '2012-12-10 14:17:07') AND ("orders"."pay_type" = 'po'))
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `rescue in log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:204:in `log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `block in execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:418:in `catch_schema_changes'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:321:in `select'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all_with_query_cache'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:665:in `find_by_sql'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1582:in `find_every'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:619:in `find'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:186:in `block in method_missing'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2182:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:179:in `method_missing'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:186:in `block in method_missing'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2182:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:179:in `method_missing'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:193:in `load_found'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:171:in `proxy_found'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:114:in `to_a'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:79
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'>> #END:ranges
?> LineItem.delete_all
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: line_items: DELETE FROM "line_items" WHERE 1=1
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `rescue in log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:204:in `log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `block in execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:418:in `catch_schema_changes'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:265:in `update_sql'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:176:in `update_sql'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:270:in `delete_sql'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:182:in `delete_sql'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:54:in `delete'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:19:in `delete_with_query_dirty'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:904:in `delete_all'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:82
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> Product.delete_all
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: products: DELETE FROM "products" WHERE 1=1
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `rescue in log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:204:in `log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `block in execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:418:in `catch_schema_changes'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:265:in `update_sql'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:176:in `update_sql'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:270:in `delete_sql'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:182:in `delete_sql'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:54:in `delete'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:19:in `delete_with_query_dirty'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:904:in `delete_all'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:83
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> p = Product.create(:title => "Programming Ruby", :price => 49.95)
ActiveRecord::StatementInvalid: Could not find table 'products'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `block in table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:3067:in `attributes_from_column_definition'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/locking/optimistic.rb:66:in `attributes_from_column_definition_with_lock'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2473:in `initialize'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:725:in `new'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:725:in `create'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:84
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> LineItem.create(:quantity => 2, :unit_price => 49.95, :total_price => 99.90,
?> :product_id => p.id, :order_id => first)
RuntimeError: Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:86
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
?> items = LineItem.find_by_sql("select *, " +
?> " quantity*unit_price as total_price, " +
?> " products.title as title " +
?> " from line_items, products " +
?> " where line_items.product_id = products.id ")
LineItem Load (0.0ms) SQLite3::SQLException: no such table: line_items: select *, quantity*unit_price as total_price, products.title as title from line_items, products where line_items.product_id = products.id
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: line_items: select *, quantity*unit_price as total_price, products.title as title from line_items, products where line_items.product_id = products.id
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `rescue in log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:204:in `log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `block in execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:418:in `catch_schema_changes'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:321:in `select'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all_with_query_cache'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:665:in `find_by_sql'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:89
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> li = items[0]
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:94
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> puts "#{li.title}: #{li.quantity}x#{li.unit_price} => #{li.total_price}"
NoMethodError: undefined method `title' for nil:NilClass
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activesupport/lib/active_support/whiny_nil.rb:52:in `method_missing'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:95
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
?> c1 = Order.count
ActiveRecord::StatementInvalid: Could not find table 'orders'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `block in table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/calculations.rb:300:in `column_for'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/calculations.rb:129:in `calculate'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/calculations.rb:48:in `count'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:99
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> c2 = Order.count(:conditions => ["name = ?", "Dave Thomas"])
ActiveRecord::StatementInvalid: Could not find table 'orders'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `block in table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/calculations.rb:300:in `column_for'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/calculations.rb:129:in `calculate'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/calculations.rb:48:in `count'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:100
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> c3 = LineItem.count_by_sql("select count(*) " +
?> " from line_items, orders " +
?> " where line_items.order_id = orders.id " +
?> " and orders.name = 'Dave Thomas' ")
LineItem Count (0.0ms) SQLite3::SQLException: no such table: line_items: select count(*) from line_items, orders where line_items.order_id = orders.id and orders.name = 'Dave Thomas'
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: line_items: select count(*) from line_items, orders where line_items.order_id = orders.id and orders.name = 'Dave Thomas'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `rescue in log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:204:in `log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `block in execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:418:in `catch_schema_changes'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:321:in `select'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all_with_query_cache'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:13:in `select_one'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:19:in `select_value'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:920:in `count_by_sql'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:101
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> puts "Dave has #{c3} line items in #{c2} orders (#{c1} orders in all)"
Dave has line items in orders ( orders in all)
=> nil
?> order = Order.find_by_name("Dave Thomas")
ActiveRecord::StatementInvalid: Could not find table 'orders'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `block in table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1318:in `column_names'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1331:in `column_methods_hash'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `block in all_attributes_exists?'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `each'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `all?'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `all_attributes_exists?'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1876:in `method_missing'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:109
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> orders = Order.find_all_by_name("Dave Thomas")
ActiveRecord::StatementInvalid: Could not find table 'orders'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `block in table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1318:in `column_names'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1331:in `column_methods_hash'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `block in all_attributes_exists?'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `each'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `all?'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `all_attributes_exists?'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1876:in `method_missing'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:110
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> orders = Order.find_all_by_email(params['email'])
ActiveRecord::StatementInvalid: Could not find table 'orders'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `block in table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1318:in `column_names'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1331:in `column_methods_hash'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `block in all_attributes_exists?'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `each'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `all?'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `all_attributes_exists?'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1876:in `method_missing'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:111
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> o = LineItem.find(:all,
?> :conditions => "pr.title = 'Programming Ruby'",
LineItem Load (0.0ms) SQLite3::SQLException: no such table: line_items: SELECT "line_items".* FROM "line_items" inner join products as pr on line_items.product_id = pr.id WHERE (pr.title = 'Programming Ruby')
?> :joins => "inner join products as pr on line_items.product_id = pr.id")
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: line_items: SELECT "line_items".* FROM "line_items" inner join products as pr on line_items.product_id = pr.id WHERE (pr.title = 'Programming Ruby')
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `rescue in log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:204:in `log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `block in execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:418:in `catch_schema_changes'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
LineItem Delete all (0.0ms) SQLite3::SQLException: no such table: line_items: DELETE FROM "line_items" WHERE 1=1
Order Update (0.0ms) SQLite3::SQLException: no such table: orders: UPDATE "orders" SET pay_type = 'wibble'
Order Delete all (0.0ms) SQLite3::SQLException: no such table: orders: DELETE FROM "orders" WHERE (pay_type = 'wibble')
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:321:in `select'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all_with_query_cache'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:665:in `find_by_sql'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1582:in `find_every'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:619:in `find'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:114
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> p o.size
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.size
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:117
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> LineItem.delete_all
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: line_items: DELETE FROM "line_items" WHERE 1=1
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `rescue in log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:204:in `log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `block in execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:418:in `catch_schema_changes'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:265:in `update_sql'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:176:in `update_sql'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:270:in `delete_sql'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:182:in `delete_sql'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:54:in `delete'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:19:in `delete_with_query_dirty'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:904:in `delete_all'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:119
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> res = Order.update_all("pay_type = 'wibble'")
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: orders: UPDATE "orders" SET pay_type = 'wibble'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `rescue in log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:204:in `log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `block in execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:418:in `catch_schema_changes'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:265:in `update_sql'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:176:in `update_sql'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:49:in `update'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:19:in `update_with_query_dirty'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:851:in `update_all'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:121
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> p res
nil
=> nil
>> res = Order.delete_all(["pay_type = ?", "wibble"])
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: orders: DELETE FROM "orders" WHERE (pay_type = 'wibble')
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `rescue in log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:204:in `log'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `block in execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:418:in `catch_schema_changes'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:265:in `update_sql'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:176:in `update_sql'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:270:in `delete_sql'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:182:in `delete_sql'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:54:in `delete'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:19:in `delete_with_query_dirty'
from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:904:in `delete_all'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:124
from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
>> p res
nil
=> nil
irb e1/ar/dump_serialize_table.rb
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties/lib/rails/gem_dependency.rb:21.
NOTE: Gem::SourceIndex#initialize is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#initialize called from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:100.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Switch to inspect mode.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
>> $: << File.dirname(__FILE__)
=> ["/home/rubys/git/awdwr/edition3/work-192-23/migration/app/controllers/", "/home/rubys/git/awdwr/edition3/work-192-23/migration/app", "/home/rubys/git/awdwr/edition3/work-192-23/migration/app/models", "/home/rubys/git/awdwr/edition3/work-192-23/migration/app/controllers", "/home/rubys/git/awdwr/edition3/work-192-23/migration/app/helpers", "/home/rubys/git/awdwr/edition3/work-192-23/migration/lib", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties/lib/../builtin/rails_info/", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties/lib", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activesupport/lib", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/actionpack/lib", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/actionmailer/lib", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activeresource/lib", "/home/rubys/git/gorp/lib", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/x86_64-linux", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/vendor_ruby/1.9.1", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/vendor_ruby/1.9.1/x86_64-linux", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/vendor_ruby", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/x86_64-linux", "/home/rubys/git/awdwr/edition3/data/code/e1/ar"]
>> require 'connect'
=> true
>> require 'rubygems'
=> []
>> require 'active_record'
=> []
>> require 'pp'
=> ["PP"]
>> ActiveRecord::Schema.define do
?> create_table :purchases, :force => true do |t|
?> t.string :name
>> t.text :last_five
>> end
>> end
-- create_table(:purchases, {:force=>true})
-> 0.2819s
=> nil
?> class Purchase < ActiveRecord::Base
>> serialize :last_five
>> # ...
?> end
=> Object
?> purchase = Purchase.new
=> #<Purchase id: nil, name: nil, last_five: nil>
>> purchase.name = "Dave Thomas"
=> "Dave Thomas"
>> purchase.last_five = [ 'shoes', 'shirt', 'socks', 'ski mask', 'shorts' ]
=> ["shoes", "shirt", "socks", "ski mask", "shorts"]
>> purchase.save
=> true
?> purchase = Purchase.find_by_name("Dave Thomas")
=> #<Purchase id: 1, name: "Dave Thomas", last_five: ["shoes", "shirt", "socks", "ski mask", "shorts"]>
>> pp purchase.last_five
["shoes", "shirt", "socks", "ski mask", "shorts"]
=> ["shoes", "shirt", "socks", "ski mask", "shorts"]
>> pp purchase.last_five[3]
"ski mask"
=> "ski mask"
=> nil
irb e1/ar/aggregation.rb
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties/lib/rails/gem_dependency.rb:21.
NOTE: Gem::SourceIndex#initialize is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#initialize called from /home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:100.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Switch to inspect mode.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:91.
>> $: << File.dirname(__FILE__)
=> ["/home/rubys/git/awdwr/edition3/work-192-23/migration/app/controllers/", "/home/rubys/git/awdwr/edition3/work-192-23/migration/app", "/home/rubys/git/awdwr/edition3/work-192-23/migration/app/models", "/home/rubys/git/awdwr/edition3/work-192-23/migration/app/controllers", "/home/rubys/git/awdwr/edition3/work-192-23/migration/app/helpers", "/home/rubys/git/awdwr/edition3/work-192-23/migration/lib", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties/lib/../builtin/rails_info/", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/railties/lib", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activesupport/lib", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/actionpack/lib", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activerecord/lib", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/actionmailer/lib", "/home/rubys/git/awdwr/edition3/work-192-23/migration/vendor/rails/activeresource/lib", "/home/rubys/git/gorp/lib", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/x86_64-linux", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/vendor_ruby/1.9.1", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/vendor_ruby/1.9.1/x86_64-linux", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/vendor_ruby", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1", "/home/rubys/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/x86_64-linux", "/home/rubys/git/awdwr/edition3/data/code/e1/ar"]
>> require "connect"
=> true
>> require "logger"
=> []
>> require "pp"
=> ["PP"]
>> #ActiveRecord::Base.logger = Logger.new(STDERR)
?> #require "rubygems"
?> #require_gem "active_record"
?> ActiveRecord::Schema.define do
?> create_table :customers, :force => true do |t|
?> t.datetime :created_at
>> t.decimal :credit_limit, :precision => 10, :scale => 2, :default => 100
>> t.string :first_name
>> t.string :initials
>> t.string :last_name
>> t.datetime :last_purchase
>> t.integer :purchase_count, :default => 0
>> end
>> end
-- create_table(:customers, {:force=>true})
-> 0.2158s
=> nil
?> class LastFive
>> attr_reader :list
>> # Takes a string containing "a,b,c" and
?> # stores [ 'a', 'b', 'c' ]
?> def initialize(list_as_string)
>> @list = list_as_string.split(/,/)
>> end
>> # Returns our contents as a
?> # comma delimited string
?> def last_five
>> @list.join(',')
>> end
>> end
=> nil
?> class Purchase < ActiveRecord::Base
>> composed_of :last_five
>> end
=> #<ActiveRecord::Reflection::AggregateReflection:0x00000003748d00 @macro=:composed_of, @name=:last_five, @options={}, @active_record=Purchase(id: integer, name: string, last_five: text)>
>> Purchase.delete_all
=> 1
?> Purchase.create(:last_five => LastFive.new("3,4,5"))
=> #<Purchase id: 2, name: nil, last_five: "3,4,5">
>> purchase = Purchase.find(:first)
=> #<Purchase id: 2, name: nil, last_five: "3,4,5">
>> puts purchase.last_five.list[1] #=> 4
4
=> nil
?> class Name
>> attr_reader :first, :initials, :last
>> def initialize(first, initials, last)
>> @first = first
>> @initials = initials
>> @last = last
>> end
>> def to_s
>> [ @first, @initials, @last ].compact.join(" ")
>> end
>> end
=> nil
?> class Customer < ActiveRecord::Base
>> composed_of :name,
?> :class_name => "Name",
?> :mapping =>
?> [ # database ruby
?> %w[ first_name first ],
?> %w[ initials initials ],
?> %w[ last_name last ]
>> ]
>> end
=> #<ActiveRecord::Reflection::AggregateReflection:0x0000000267df70 @macro=:composed_of, @name=:name, @options={:class_name=>"Name", :mapping=>[["first_name", "first"], ["initials", "initials"], ["last_name", "last"]]}, @active_record=Customer(id: integer, created_at: datetime, credit_limit: decimal, first_name: string, initials: string, last_name: string, last_purchase: datetime, purchase_count: integer)>
>> Customer.delete_all
=> 0
?> name = Name.new("Dwight", "D", "Eisenhower")
=> Dwight D Eisenhower
>> Customer.create(:credit_limit => 1000, :name => name)
=> #<Customer id: 1, created_at: "2012-12-17 14:17:18", credit_limit: #<BigDecimal:21dcc78,'0.1E4',9(18)>, first_name: "Dwight", initials: "D", last_name: "Eisenhower", last_purchase: nil, purchase_count: 0>
>> customer = Customer.find(:first)
=> #<Customer id: 1, created_at: "2012-12-17 14:17:18", credit_limit: #<BigDecimal:211c180,'0.1E4',9(18)>, first_name: "Dwight", initials: "D", last_name: "Eisenhower", last_purchase: nil, purchase_count: 0>
>> puts customer.name.first #=> Dwight
Dwight
=> nil
>> puts customer.name.last #=> Eisenhower
Eisenhower
=> nil
>> puts customer.name.to_s #=> Dwight D Eisenhower
Dwight D Eisenhower
=> nil
>> customer.name = Name.new("Harry", nil, "Truman")
=> Harry Truman
>> customer.save
=> true
=> nil