如何解决ROR-4中的加载错误

时间:2014-12-19 06:51:35

标签: mysql ruby-on-rails ruby

plase任何可以帮我解决这个错误。在输入gem install mysql之后,我输入了bundle install。 当我输入命令rake db:create / bundle exec rake db:create it时出现以下错误。

错误:

LoadError: cannot load such file -- mysql/mysql_api
c:/Site/book/config/application.rb:7:in `<top (required)>'
c:/Site/book/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)

配置/ application.rb中

require File.expand_path('../boot', __FILE__)

require 'rails/all'

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

module Sqldb
  class Application < Rails::Application
    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration should go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded.

    # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
    # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
    # config.time_zone = 'Central Time (US & Canada)'

    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
    # config.i18n.default_locale = :de
  end
end

我的rakefile包含以下代码。

# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)

Rails.application.load_tasks

请帮我解决此错误。

1 个答案:

答案 0 :(得分:0)

您是否尝试从32位Ruby安装访问64位MySQL安装。这似乎是很多人的问题,即使我在使用新的Win7(64位)新机器时遇到了这个问题。

尝试在此博客上提供的解决方案: -

http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/