开发者

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'

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜