Note that there are some explanatory texts on larger screens.

plurals
  1. POtrying to use ActiveRecord with Sinatra, Migration fails question
    primarykey
    data
    text
    <p>running Sinatra 1.0, I wanted to add a database table to my program. In my Rakefile I have a task</p> <pre><code>task :environment do ActiveRecord::Base.establish_connection(YAML::load(File.open('config/database.yml'))["development"]) end </code></pre> <p>I have a migration task in my namespace that calls the migration code:</p> <pre><code> namespace :related_products do desc "run any migrations we may have in db/migrate" task :migrate =&gt; :environment do ActiveRecord::Migrator.migrate('db/migrate', ENV["VERSION"] ? ENV["VERSION"].to_i : nil ) end </code></pre> <p>My console pukes out an error when the call to ActiveRecord::MIgrator.migrate() is made. rake aborted! undefined method `info' for nil:NilClass</p> <p>The migration code itself is pretty simple... and presents me with no clues as to what this missing info class is.</p> <pre><code> class CreateStores &lt; ActiveRecord::Migration def self.up create_table :stores do |t| t.string :name t.string :access_url t.timestamps end end def self.down drop_table :stores end end </code></pre> <p>I am a little mystified here and am looking for some clues as to what might be wrong. Thanks! </p> <p>A simple backtrace shows the offensive line is simply the call to the migration:</p> <pre><code> rake aborted! undefined method `info' for nil:NilClass /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:473:in `migrate' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:472:in `each' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:472:in `migrate' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:400:in `up' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:383:in `migrate' /Users/baz/Documents/workspace/rp/Rakefile:26 /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31 /usr/bin/rake:19:in `load' /usr/bin/rake:19 </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload