Cant create database for ruby on rails
I've just starting ruby on rails and I am still busy setting everything up running.. the problem that I encounter is that it keeps saying that mysql2 is not part of a bundle.. I have googled it obviously but the solutions didn't seem to work
sudo gem install mysql2
etc..
the stuff I get is
$ rake db:create rake aborted! Please install the mysql2 adapter: gem install activerecord-mysql2-adapter
(mysql2 is not part of the bundle. Add it to Gemfile.) /Library/Ruby/Gems/1.8/gems/bundler-1.3.2/lib/bundler/rubygems_integration.rb:214:in gem' /Library/Ruby/Gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/mysql2_adapter.rb:3 /Library/Ruby/Gems/1.8/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in
require' /Library/Ruby/Gems/1.8/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in require' /Library/Ruby/Gems/1.8/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in
load_dependency' /Library/Ruby/Gems/1.8/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in require' /Library/Ruby/Gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_specification.rb:50:in
resolve_hash_connection' /Library/Ruby/Gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_specif ication.rb:29:in spec' /Library/Ruby/Gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_specification.rb:130:in
establish_connection' /Library/Ruby/Gems/1.8/gems/activerecord-3.2.12/lib/active_record/railties/databases.rake:90:in create_database' /Library/Ruby/Gems/1.8/gems/activerecord-3.2.12/lib/active_record/railties/databases.rake:62 /Library/Ruby/Gems/1.8/gems/activerecord-3.2.12/lib/active_record/railties/databases.rake:62:in
each' /Library/Ruby/Gems/1.8/gems/activerecord-3.2.12/lib/active_record/railties/databases.rake:62 Tasks: TOP => db:create (See full trace by running task with --trace)
Anyone here knows the solution for me? ( ps I see alot people saying that it has to be added to the gem config but how? )
You should make sure your Gemfile
(located in the root of your project) includes
gem 'mysql2'
Then run the bundle install
to install it.
I believe the activerecord-mysql2-adapter
gem is installed as a dependency, but you can also add
gem 'activerecord-mysql2-adapter'
If it still requests it.
链接地址: http://www.djcxy.com/p/81112.html上一篇: 在宝石中扩展导轨模型
下一篇: 无法在rails上为ruby创建数据库