samedi 23 avril 2016

Configuring a Project for a Database Ruby on Rails

So I'm new to programing and I'm teaching myself Ruby on Rails to get started. I have mysql running and I've downloaded Ruby ruby 2.3.0 and Rails 3.2.22.2 because these are the versions being used in the video tutorial.

I was generating a controller & view, however when it came to the moment of truth to see if everything worked there were problems. I programmed index.html.erb to say "hello world" in my browser but received this message:

ActiveRecord::ConnectionNotEstablished

I believe this is because it's trying to contact the database. So I started to create the database on mysml, and as I reach the point where I create a schema.rb in the dp folder. Only when I type the command in terminal I get this:

julian$ rake db:schema:dump
rake aborted!
LoadError: Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter` (can't activate mysql2 (~> 0.3.10), already activated mysql2-0.4.4. Make sure all dependencies are added to Gemfile.)
/Users/julian/Sites/simple_cms/config/environment.rb:5:in `<top (required)>'
Gem::LoadError: can't activate mysql2 (~> 0.3.10), already activated mysql2-0.4.4. Make sure all dependencies are added to Gemfile.
/Users/julian/Sites/simple_cms/config/environment.rb:5:in `<top (required)>'
Tasks: TOP => db:schema:dump => environment
(See full trace by running task with --trace)

What do I do? I have been stuck on this for hours, does anyone have some guidance?

Aucun commentaire:

Enregistrer un commentaire