Monday, 15 April 2013

mysql - ActiveRecord without Rails Please install the mysql2 adapter -



mysql - ActiveRecord without Rails Please install the mysql2 adapter -

i'm trying access mysql database using ruby activerecord. ruby file dbtest.rb.

require 'rubygems' require 'active_record' activerecord::base.establish_connection( :adapter => "mysql2", :host => "localhost", :database => "students" ) class rubyist < activerecord::base end

when seek load file via irb or run using ruby next error:

.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require': please install mysql2 adapter: `gem install activerecord-mysql2-adapter`

i've installed both mysql2 gem , activerecord-mysql2-adapter successfully. when installed activerecord-mysql2-adapter received next messages:

gem install activerecord-mysql2-adapter fetching: activerecord-mysql2-adapter-0.0.3.gem (100%) installed activerecord-mysql2-adapter-0.0.3 1 gem installed

do need rename adapter?

i added "export dyld_library_path=/usr/local/mysql/lib:$dyld_library_path" .bash_profile fixed it.

mysql ruby activerecord

No comments:

Post a Comment