Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Missing the mysql2 gem. Add it to your Gemfile: gem 'mysql2'

Reply
Thread Tools

Missing the mysql2 gem. Add it to your Gemfile: gem 'mysql2'

 
 
Jakub Flaška
Guest
Posts: n/a
 
      03-02-2011
Hello I have this small script:

----------------------
require 'active_record'

ActiveRecord::Base.establish_connection(
:adapter => 'mysql',
:database => 'cards',
:username => 'user',
assword => 'myPassword',
:host => 'localhost',
:charset => 'utf8',
:encoding => 'utf8',
ort => '3306')

class Start < ActiveRecord::Base
set_table_name "grb_tGStart"
set_primary_key "start_id"
has_many osts
end

starts = Start.find(:all, :conditions => [ "agency_id = (?) AND
is_active = (?)", 17, 1 ])

----------------------

And I got this error:
----------------------
/activerecord-3.0.5/lib/active_record/connection_adapters/mysql_adapter.rb:22:in
`rescue in mysql_connection': !!!
Missing the mysql2 gem. Add it to your Gemfile: gem 'mysql2'
(RuntimeError)

----------------------
Every hint to this issue points on a file: database.yml and there to
change adapter: mysql, to adapter: mysql2.
But I don't know what's the file databases.yml I don't have it in my
project. Can you please advice me, what's the file databases.yml?

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mysql2::Error: Can't create database Rajesh B. Ruby 2 03-25-2011 08:39 PM
Rails: Problem with test-environment and mysql2 database vivec manavortex Ruby 3 01-26-2011 01:14 PM
gem 1.3.0, netbeans 6.1 "Missing the Rails gem" Pablo Q. Ruby 4 10-09-2008 04:12 AM
RubyGems 0.9.1 calling a gem with gem '<gem>' Austin 7873 Ruby 5 01-27-2007 10:05 PM
[ANN] Getopt-Declare 1.12 (gem/zip) and GGEnv (gem/zip) gga Ruby 0 07-18-2005 03:21 PM



Advertisments