Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialHarrison Hondo
7,283 PointsHow am I supposed to replace the project files without getting a bunch of errors?
I have tried to replace my biller project folder with the new project files but when I try to load up the rails server it gives me the error: Migrations are pending. To resolve this issue, run: bin/rake db:migrate RAILS_ENV=development
I then try to run this command and it aborts my rake saying: rake aborted! uninitialized constant Mysql2::Client::SECURE_CONNECTION
I have looked at the similar questions and answers to this problem but they did not end up working for me
Harrison Hondo
7,283 PointsIn the ActiveRecord Basics course the instructor gives new project files for the "biller" project during this video https://teamtreehouse.com/library/rails-models/migrations-and-relationships/looking-at-our-application
I've tried changing my original projects name and just replaced it with the new one and it gives me this error.
1 Answer
Maciej Czuchnowski
36,441 PointsOK, don't treat it as replacing. Just use it as another project. You could also try doing rake db:drop
, rake db:create
and then rake db:migrate
again. This will apply the project's database with the one from the new migration files. You will lose all data from that database though.
Harrison Hondo
7,283 PointsWhen I try to run rake commands I get this error: Gem::LoadError: You have already activated rake 10.4.2, but your Gemfile requires rake 10.1.1. Prepending bundle exec
to your command may solve this.
When I try to run bundle exec rake it tells me
rake aborted! uninitialized constant Mysql2::Client::SECURE_CONNECTION
Maciej Czuchnowski
36,441 PointsDid you set up the config/database.yml file properly for your Mysql installation? Did mysql run fine in your original project?
Harrison Hondo
7,283 PointsI'm not sure I've done that, I haven't looked into it at all and don't really understand it very well. Although I do remember having to add my mysql2 password to the database.yml file in my original project because it was prompting me to give my password. Mysql2 ran fine in my original project but it has stopped working in my original one since I started messing around with the folder names.
Maciej Czuchnowski
36,441 PointsMysql is always messy and problematic...I can't really help you any further, since I can't even successfully run the project on my own machine because of MySQL issues.
Harrison Hondo
7,283 PointsThat's unfortunate to hear, thanks for trying anyways.
Maciej Czuchnowski
36,441 PointsAnother idea - go to this database.yml file and change the name of the database, see if that helps. Both your apps probably use the same database, this may cause problems.
Harrison Hondo
7,283 PointsAre you suggesting that I change the name of the file of the database named within the file? I tried doing both but no success. If I can't get this to work do you have any suggestions on how I should proceed to try and finish my track?
Maciej Czuchnowski
36,441 PointsThe database.yml file has this line: database: biller_development
in the development section. Just rename it and try again. Won't hurt, and it should create a completely new database in your mysql. Using the same name of the database in two different projects is not a good idea.
I managed to run everything after updating Ruby to the newest version (using rvm) and reinstalling mysql completely. I'm using Linux btw.
Harrison Hondo
7,283 PointsStill no luck...
Maciej Czuchnowski
36,441 PointsMaciej Czuchnowski
36,441 PointsWhy did you replace any files and what were those files?