Strange errors with Active Record migration in Sinatra
Below is my Rakefile for migration in Sintra. I got 2 strange errors when I run it
uninitialized constant Logger (on line ActiveRecord::Base.logger = Logger.new(STDOUT))
can't convert String into Integer (on line ActiveRecord::Migrator.migrate('db/migrate'))
namespace :db do
task :environment do
require 'active_record'
ActiveRecord::Base.establish_connection :adapter => 'mysql2', :port => '/Applications/MAMP/tmp/mysql/mysql.sock'
end
desc "Migrate the database"
task(:migrate => :environment) do
#A开发者_开发百科ctiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Migration.verbose = true
ActiveRecord::Migrator.migrate('db/migrate')
end
end
Does anyone have any idea how to fix these? Thanks.
uninitialized constant Logger
Include the Logger class in the Ruby standard library before using it: require 'logger'
精彩评论