Reputation: 151
the issue that I'm dealing with is the following. I've installed a brand new ruby environment. In my current project I'ld like to use the following gems:
RAILS_VERSION = '~> 3.0.4'
DM_VERSION = '~> 1.1.0'
gem 'rails', '3.0.9'
# Database & ORM
gem 'mysql2', '< 0.3'
gem 'data_mapper', DM_VERSION
gem 'dm-mysql-adapter', DM_VERSION
gem 'dm-rails', DM_VERSION
# Authentication
gem 'devise'
gem 'dm-devise'
I have the following database.yml:
defaults: &defaults
adapter: mysql2
encoding: utf8
reconnect: false
pool: 5
username: blabla
password: albalb
host: localhost
socket: /tmp/mysql.sock
Performing "bundle install" does not result into any kind of error. But as soon as I want to do some thing with the database (like "rails s", or "rake db:migrate") the folling error occurrs:
/Users/Gery/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require': no such file to load -- dm-mysql2-adapter (LoadError)
from /Users/Gery/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
from /Users/Gery/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Users/Gery/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /Users/Gery/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Users/Gery/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
Do you have any idea how to solve this problem?
Best Regards,
Gerardo
Upvotes: 2
Views: 1383
Reputation: 7084
I just went into #datamapper and solnic helped me understand this: there is no need to use the mysql2
gem with DataMapper, because do-mysql
(the DataObject driver dm-mysql-adapter depends on to access MySQL repositories) doesn't have problems with character-encodings, which is the reason I (and most people, I would assume) use the mysql2
driver in ActiveRecord projects.
So the answer is, unless I'm mistaken about why you're using it, remove mysql2
from your Gemfile and your database.yml file (replace it with mysql
) and do a new bundle install
, you shouldn't need it.
Upvotes: 4
Reputation: 481
This is a bug in dm-core as a result of sub-standard coding. I have committed a hack to fix this hack and submitted a pull request here: https://github.com/datamapper/dm-core/pull/154
Upvotes: 0