请任何人可以帮助我解决此错误。输入 gem install mysql 后,我输入了bundle install。 当我输入命令 rake db:create/bundle exec rake db:create 时,出现以下错误。
错误:
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
请帮助我解决此错误。
最佳答案
您是否尝试从 32 位 Ruby 安装访问 64 位 MySQL 安装。这似乎是很多人的问题,甚至我在拥有新的Win7(64位)新机器时也遇到过这个问题。
尝试此博客上提供的解决方案:-
http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/
关于mysql - 如何解决 ROR-4 中的加载错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27561033/