Questions tagged «mysql2»


9
Rails 4-Gem :: LoadError:为数据库适配器指定了“ mysql2”,但未加载gem
在我的gemfile中,我有: gem 'mysql2' 我的database.yml如下: default: &default adapter: mysql2 database: <%= ENV['db_name'] %> username: <%= ENV['db_user'] %> password: <%= ENV['db_pass'] %> host: <%= ENV['db_host'] %> pool: 32 socket: <%= ENV['socket'] %> development: <<: *default production: <<: *default 我都运行了bundle update,bundle install并且我的Gemfile.lock显示mysql2。 但是,当我运行时,我rake db:migrate在计算机和登台服务器上都收到了此消息: myproject.com(master)$ rake db:migrate WARNING: Use strings for Figaro configuration. …

14
mysql2 gem的Gem :: LoadError,但是它已经在Gemfile中
Gem::LoadError Specified 'mysql2' for database adapter, but the gem is not loaded. Add `gem 'mysql2'` to your Gemfile 加载以下文件时发生此错误: active_record/base 这是我在运行Rails服务器时遇到的错误。 The mysql2 gem has been added to the Gemfile as well. 我已经完成了bundle install,并尝试重新启动服务器,但仍然收到错误消息。

11
尝试使用mysql2 gem安装应用程序时出错
我正在尝试安装使用mysql2gem的开源Rails 3.2.21应用程序,但是当我尝试运行bundle命令时,出现以下错误: Fetching: mysql2-0.3.18.gem (100%) Building native extensions. This could take a while... p ERROR: Error installing mysql2: ERROR: Failed to build gem native extension. /Users/my_username/.rvm/rubies/ruby-2.1.2/bin/ruby -r ./siteconf20150614-72129-orqsb7.rb extconf.rb checking for ruby/thread.h... yes checking for rb_thread_call_without_gvl() in ruby/thread.h... yes checking for rb_thread_blocking_region()... yes checking for rb_wait_for_single_fd()... yes checking for rb_hash_dup()... …

12
在Rails 4中向左外联接
我有3种型号: class Student < ActiveRecord::Base has_many :student_enrollments, dependent: :destroy has_many :courses, through: :student_enrollments end class Course < ActiveRecord::Base has_many :student_enrollments, dependent: :destroy has_many :students, through: :student_enrollments end class StudentEnrollment < ActiveRecord::Base belongs_to :student belongs_to :course end 我希望在“课程”表中查询课程列表,该列表在与某个学生相关联的“学生录取”表中不存在。 我发现也许使用Left Join是可行的方法,但似乎rails中的joins()仅接受一个表作为参数。我认为可以执行的SQL查询是: SELECT * FROM Courses c LEFT JOIN StudentEnrollment se ON c.id …

11
Ruby gem MySQL2安装失败
当我尝试安装mysql2 gem时,它失败,没有明显的错误。有谁知道该怎么做才能解决此问题,以便安装mysql2? $ sudo gem install mysql2 Building native extensions. This could take a while... ERROR: Error installing mysql2: ERROR: Failed to build gem native extension. /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb checking for rb_thread_blocking_region()... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lm... yes checking for mysql_query() in -lmysqlclient... no …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.