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
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-187-23/migration/config/../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-187-23/migration/config/../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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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-187-23/migration/config/../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-187-23/migration/config/../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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
>> Order.column_names
ActiveRecord::StatementInvalid: Could not find table 'orders'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1318:in `column_names'
from (irb):1
>>
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-187-23/migration/config/../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-187-23/migration/config/../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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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-187-23/migration/config/../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-187-23/migration/config/../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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
>> Order.columns_hash["pay_type"]
ActiveRecord::StatementInvalid: Could not find table 'orders'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1313:in `columns_hash'
from (irb):1
>>
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-187-23/migration/config/../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-187-23/migration/config/../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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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-187-23/migration/config/../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-187-23/migration/config/../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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
>> 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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:321:in `select'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:665:in `find_by_sql'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1582:in `find_every'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1539:in `find_initial'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:617:in `find'
from (irb):1
>>
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 ./config/../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 ./config/../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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
>> $: << File.dirname(__FILE__)
=> ["/home/rubys/git/awdwr/edition3/work-187-23/migration/app/controllers/", "/home/rubys/git/awdwr/edition3/work-187-23/migration/app", "/home/rubys/git/awdwr/edition3/work-187-23/migration/app/models", "/home/rubys/git/awdwr/edition3/work-187-23/migration/app/controllers", "/home/rubys/git/awdwr/edition3/work-187-23/migration/app/helpers", "/home/rubys/git/awdwr/edition3/work-187-23/migration/lib", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor", "./config/../vendor/rails/railties/lib/../builtin/rails_info/", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/railties", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/railties/lib", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activesupport/lib", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/actionpack/lib", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/actionmailer/lib", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activeresource/lib", "./config/../vendor/rails/railties/lib", "/home/rubys/git/gorp/lib", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby/1.8", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby/1.8/x86_64-linux", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/vendor_ruby/1.8", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/vendor_ruby/1.8/x86_64-linux", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/vendor_ruby", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:3067:in `attributes_from_column_definition_without_lock'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/locking/optimistic.rb:66:in `attributes_from_column_definition'
from /home/rubys/git/awdwr/edition3/work-187-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
>> an_order.name = "Dave Thomas"
NoMethodError: undefined method `name=' for nil:NilClass
from /home/rubys/git/awdwr/edition3/work-187-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
>> an_order.email = "dave@example.com"
NoMethodError: undefined method `email=' for nil:NilClass
from /home/rubys/git/awdwr/edition3/work-187-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
>> an_order.address = "123 Main St"
NoMethodError: undefined method `address=' for nil:NilClass
from /home/rubys/git/awdwr/edition3/work-187-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
>> an_order.pay_type = "check"
NoMethodError: undefined method `pay_type=' for nil:NilClass
from /home/rubys/git/awdwr/edition3/work-187-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
>> 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
?> 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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:3067:in `attributes_from_column_definition_without_lock'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/locking/optimistic.rb:66:in `attributes_from_column_definition'
from /home/rubys/git/awdwr/edition3/work-187-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
?> 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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:3067:in `attributes_from_column_definition_without_lock'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/locking/optimistic.rb:66:in `attributes_from_column_definition'
from /home/rubys/git/awdwr/edition3/work-187-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
>> 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
?> an_order = Order.new
ActiveRecord::StatementInvalid: Could not find table 'orders'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:3067:in `attributes_from_column_definition_without_lock'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/locking/optimistic.rb:66:in `attributes_from_column_definition'
from /home/rubys/git/awdwr/edition3/work-187-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
>> an_order.name = "Dave Thomas"
NoMethodError: undefined method `name=' for nil:NilClass
from /home/rubys/git/awdwr/edition3/work-187-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
>> # ...
?> 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
>> 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
?> 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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:3067:in `attributes_from_column_definition_without_lock'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/locking/optimistic.rb:66:in `attributes_from_column_definition'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2473:in `initialize'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:725:in `new'
from /home/rubys/git/awdwr/edition3/work-187-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
?> 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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:3067:in `attributes_from_column_definition_without_lock'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/locking/optimistic.rb:66:in `attributes_from_column_definition'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2473:in `initialize'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:725:in `new'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:725:in `create'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:723:in `create'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:723:in `collect'
from /home/rubys/git/awdwr/edition3/work-187-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
>> >> => 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 ./config/../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 ./config/../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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
>> $: << File.dirname(__FILE__)
=> ["/home/rubys/git/awdwr/edition3/work-187-23/migration/app/controllers/", "/home/rubys/git/awdwr/edition3/work-187-23/migration/app", "/home/rubys/git/awdwr/edition3/work-187-23/migration/app/models", "/home/rubys/git/awdwr/edition3/work-187-23/migration/app/controllers", "/home/rubys/git/awdwr/edition3/work-187-23/migration/app/helpers", "/home/rubys/git/awdwr/edition3/work-187-23/migration/lib", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor", "./config/../vendor/rails/railties/lib/../builtin/rails_info/", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/railties", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/railties/lib", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activesupport/lib", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/actionpack/lib", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/actionmailer/lib", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activeresource/lib", "./config/../vendor/rails/railties/lib", "/home/rubys/git/gorp/lib", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby/1.8", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby/1.8/x86_64-linux", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/vendor_ruby/1.8", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/vendor_ruby/1.8/x86_64-linux", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/vendor_ruby", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/x86_64-linux", ".", "/home/rubys/git/awdwr/edition3/data/code/e1/ar"]
>> require "connect"
=> true
>> require "logger"
=> []
>> ActiveRecord::Base.logger = Logger.new(STDERR)
=> #<Logger:0x7f2da4403188 @progname=nil, @logdev=#<Logger::LogDevice:0x7f2da44030e8 @filename=nil, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x7f2da4403098 @mon_entering_queue=[], @mon_count=0, @mon_owner=nil, @mon_waiting_queue=[]>, @dev=#<IO:0x7f2da9117aa0>, @shift_size=nil, @shift_age=nil>, @formatter=nil, @level=0, @default_formatter=#<Logger::Formatter:0x7f2da4403138 @datetime_format=nil>>
?> 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:0x00007f2da49ee458@/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:102>
?> class Order < ActiveRecord::Base
>> named_scope :recent, :conditions => ['created_at > ?', 1.week.ago]
>> named_scope :since, lambda { |range|
?> { :conditions => ['created_at > ?', range] }
>> }
>> end
=> #<Proc:0x00007f2da49ee458@/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:102>
>> 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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:321:in `select'
Order Load (0.0ms) SQLite3::SQLException: no such table: orders: SELECT * FROM "orders" WHERE (name = 'Dave Thomas') LIMIT 1
Order Load (0.0ms) 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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:665:in `find_by_sql'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1582:in `find_every'
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'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1539:in `find_initial'
from /home/rubys/git/awdwr/edition3/work-187-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
>> # 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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:321:in `select'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:665:in `find_by_sql'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1582:in `find_every'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1539:in `find_initial'
from /home/rubys/git/awdwr/edition3/work-187-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
>> # return the latest order for Dave
?> order = Order.find(:first,
?> :conditions => "name = 'Dave Thomas'",
?> :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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
Order Load (0.0ms) SQLite3::SQLException: no such table: orders: select name, pay_type from orders
Order Load (0.0ms) SQLite3::SQLException: no such table: orders: SELECT * FROM "orders"
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:321:in `select'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:665:in `find_by_sql'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1582:in `find_every'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1539:in `find_initial'
from /home/rubys/git/awdwr/edition3/work-187-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
Order Load (0.0ms) SQLite3::SQLException: no such table: orders: SELECT * FROM "orders" WHERE ("orders"."pay_type" = 'check') LIMIT 1
?> orders = LineItem.find_by_sql("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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:321:in `select'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all'
from /home/rubys/git/awdwr/edition3/work-187-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
?> 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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-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-187-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-11-07 11:14:49') AND ("orders"."pay_type" = 'po'))
Order Load (0.0ms) SQLite3::SQLException: no such table: orders: SELECT * FROM "orders" WHERE ((created_at > '2012-11-07 11:14:49') 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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:321:in `select'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all'
from /home/rubys/git/awdwr/edition3/work-187-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
>> 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
>> 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
>> 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
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
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:65
>> 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
?> p Order.all
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: orders: SELECT * FROM "orders"
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:321:in `select'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:665:in `find_by_sql'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1582:in `find_every'
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'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:619:in `find'
from /home/rubys/git/awdwr/edition3/work-187-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
>> p Order.check(:order => "created_on desc").first
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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:321:in `select'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:665:in `find_by_sql'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1582:in `find_every'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1539:in `find_initial'
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')
LineItem Delete all (0.0ms) SQLite3::SQLException: no such table: line_items: DELETE FROM "line_items" WHERE 1=1
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:617:in `find'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:186:in `send'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:186:in `method_missing'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2182:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `__send__'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:179:in `method_missing'
from /home/rubys/git/awdwr/edition3/work-187-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>> p Order.po.recent.count
ActiveRecord::StatementInvalid: Could not find table 'orders'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
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-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/calculations.rb:300:in `column_for'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/calculations.rb:129:in `calculate'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/calculations.rb:48:in `count'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:186:in `send'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:186:in `method_missing'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2182:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `__send__'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:179:in `method_missing'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:186:in `send'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:186:in `method_missing'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2182:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `__send__'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `__send__'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-187-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>> p Order.check.find_by_name('Dave Thomas')
ActiveRecord::StatementInvalid: Could not find table 'orders'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1318:in `column_names'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1331:in `column_methods_hash'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `all_attributes_exists?'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:74:in `all?'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `each'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `all?'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `all_attributes_exists?'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1876:in `method_missing'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:186:in `send'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:186:in `method_missing'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2182:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `__send__'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-187-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>> #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-11-07 11:14:49') AND ("orders"."pay_type" = 'po'))
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:321:in `select'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:665:in `find_by_sql'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1582:in `find_every'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:619:in `find'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:186:in `send'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:186:in `method_missing'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2182:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `__send__'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:179:in `method_missing'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:186:in `send'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:186:in `method_missing'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2182:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `__send__'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `__send__'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:179:in `method_missing'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:193:in `load_found'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:171:in `proxy_found'
from /home/rubys/git/awdwr/edition3/work-187-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>> p Order.po.since(1.week.ago).to_a
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: orders: SELECT * FROM "orders" WHERE ((created_at > '2012-11-07 11:14:49') AND ("orders"."pay_type" = 'po'))
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:321:in `select'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:665:in `find_by_sql'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1582:in `find_every'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:619:in `find'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:186:in `send'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:186:in `method_missing'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2182:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `__send__'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:179:in `method_missing'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:186:in `send'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:186:in `method_missing'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2182:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `__send__'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `__send__'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `with_scope'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:179:in `method_missing'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:193:in `load_found'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/named_scope.rb:171:in `proxy_found'
from /home/rubys/git/awdwr/edition3/work-187-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>> #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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:176:in `update_sql'
from /home/rubys/git/awdwr/edition3/work-187-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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:182:in `delete_sql'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:54:in `delete_without_query_dirty'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:19:in `delete'
from /home/rubys/git/awdwr/edition3/work-187-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
>> Product.delete_all
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: products: DELETE FROM "products" WHERE 1=1
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:176:in `update_sql'
from /home/rubys/git/awdwr/edition3/work-187-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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:182:in `delete_sql'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:54:in `delete_without_query_dirty'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:19:in `delete'
from /home/rubys/git/awdwr/edition3/work-187-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
>> p = Product.create(:title => "Programming Ruby", :price => 49.95)
ActiveRecord::StatementInvalid: Could not find table 'products'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:3067:in `attributes_from_column_definition_without_lock'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/locking/optimistic.rb:66:in `attributes_from_column_definition'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2473:in `initialize'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:725:in `new'
from /home/rubys/git/awdwr/edition3/work-187-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
>> 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
?> 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 ")
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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:321:in `select'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all'
from /home/rubys/git/awdwr/edition3/work-187-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
>> 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
>> 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-187-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
?> c1 = Order.count
ActiveRecord::StatementInvalid: Could not find table 'orders'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/calculations.rb:300:in `column_for'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/calculations.rb:129:in `calculate'
from /home/rubys/git/awdwr/edition3/work-187-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
>> c2 = Order.count(:conditions => ["name = ?", "Dave Thomas"])
ActiveRecord::StatementInvalid: Could not find table 'orders'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/calculations.rb:300:in `column_for'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/calculations.rb:129:in `calculate'
from /home/rubys/git/awdwr/edition3/work-187-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
>> c3 = LineItem.count_by_sql("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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:321:in `select'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all'
from /home/rubys/git/awdwr/edition3/work-187-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-187-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-187-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
>> 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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1318:in `column_names'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1331:in `column_methods_hash'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `all_attributes_exists?'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:109:in `all?'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `each'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `all?'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `all_attributes_exists?'
from /home/rubys/git/awdwr/edition3/work-187-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
>> orders = Order.find_all_by_name("Dave Thomas")
ActiveRecord::StatementInvalid: Could not find table 'orders'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1318:in `column_names'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1331:in `column_methods_hash'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `all_attributes_exists?'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:110:in `all?'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `each'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `all?'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `all_attributes_exists?'
from /home/rubys/git/awdwr/edition3/work-187-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
>> orders = Order.find_all_by_email(params['email'])
ActiveRecord::StatementInvalid: Could not find table 'orders'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1318:in `column_names'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1331:in `column_methods_hash'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `all_attributes_exists?'
from /home/rubys/git/awdwr/edition3/data/code/e1/ar/find_examples.rb:111:in `all?'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `each'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `all?'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:2025:in `all_attributes_exists?'
from /home/rubys/git/awdwr/edition3/work-187-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
>> o = LineItem.find(:all,
?> :conditions => "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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:321:in `select'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:665:in `find_by_sql'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/base.rb:1582:in `find_every'
from /home/rubys/git/awdwr/edition3/work-187-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
>> 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
>> 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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:176:in `update_sql'
from /home/rubys/git/awdwr/edition3/work-187-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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:182:in `delete_sql'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:54:in `delete_without_query_dirty'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:19:in `delete'
from /home/rubys/git/awdwr/edition3/work-187-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
>> 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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:176:in `update_sql'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:49:in `update_without_query_dirty'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:19:in `update'
from /home/rubys/git/awdwr/edition3/work-187-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
>> 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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
from /home/rubys/git/awdwr/edition3/work-187-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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:176:in `update_sql'
from /home/rubys/git/awdwr/edition3/work-187-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-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:182:in `delete_sql'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:54:in `delete_without_query_dirty'
from /home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:19:in `delete'
from /home/rubys/git/awdwr/edition3/work-187-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
>> 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 ./config/../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 ./config/../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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
>> $: << File.dirname(__FILE__)
=> ["/home/rubys/git/awdwr/edition3/work-187-23/migration/app/controllers/", "/home/rubys/git/awdwr/edition3/work-187-23/migration/app", "/home/rubys/git/awdwr/edition3/work-187-23/migration/app/models", "/home/rubys/git/awdwr/edition3/work-187-23/migration/app/controllers", "/home/rubys/git/awdwr/edition3/work-187-23/migration/app/helpers", "/home/rubys/git/awdwr/edition3/work-187-23/migration/lib", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor", "./config/../vendor/rails/railties/lib/../builtin/rails_info/", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/railties", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/railties/lib", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activesupport/lib", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/actionpack/lib", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/actionmailer/lib", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activeresource/lib", "./config/../vendor/rails/railties/lib", "/home/rubys/git/gorp/lib", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby/1.8", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby/1.8/x86_64-linux", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/vendor_ruby/1.8", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/vendor_ruby/1.8/x86_64-linux", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/vendor_ruby", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/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.1632s
=> 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"]
=> nil
>> pp purchase.last_five[3]
"ski mask"
=> nil
>> >> => 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 ./config/../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 ./config/../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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/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.8.7-p371/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
>> $: << File.dirname(__FILE__)
=> ["/home/rubys/git/awdwr/edition3/work-187-23/migration/app/controllers/", "/home/rubys/git/awdwr/edition3/work-187-23/migration/app", "/home/rubys/git/awdwr/edition3/work-187-23/migration/app/models", "/home/rubys/git/awdwr/edition3/work-187-23/migration/app/controllers", "/home/rubys/git/awdwr/edition3/work-187-23/migration/app/helpers", "/home/rubys/git/awdwr/edition3/work-187-23/migration/lib", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor", "./config/../vendor/rails/railties/lib/../builtin/rails_info/", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/railties", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/railties/lib", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activesupport/lib", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/actionpack/lib", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activerecord/lib", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/actionmailer/lib", "/home/rubys/git/awdwr/edition3/work-187-23/migration/vendor/rails/activeresource/lib", "./config/../vendor/rails/railties/lib", "/home/rubys/git/gorp/lib", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby/1.8", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby/1.8/x86_64-linux", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/vendor_ruby/1.8", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/vendor_ruby/1.8/x86_64-linux", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/vendor_ruby", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8", "/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/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.2191s
=> 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:0x7f770afce788 @active_record=Purchase(id: integer, name: string, last_five: text), @options={}, @macro=:composed_of, @name=:last_five>
>> 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:0x7f770af6cee8 @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), @options={:class_name=>"Name", :mapping=>[["first_name", "first"], ["initials", "initials"], ["last_name", "last"]]}, @macro=:composed_of, @name=:name>
>> Customer.delete_all
=> 0
?> name = Name.new("Dwight", "D", "Eisenhower")
=> #<Name:0x7f770af5cc28 @first="Dwight", @last="Eisenhower", @initials="D">
>> Customer.create(:credit_limit => 1000, :name => name)
=> #<Customer id: 1, created_at: "2012-11-14 11:14:54", credit_limit: #<BigDecimal:7f770af470d0,'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-11-14 11:14:54", credit_limit: #<BigDecimal:7f770af40398,'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")
=> #<Name:0x7f770af2d1d0 @first="Harry", @last="Truman", @initials=nil>
>> customer.save
=> true
>> >> => nil