Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ruby ActiveRecord Basics Migrations and Relationships Looking at our Application

How 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

Maciej Czuchnowski
Maciej Czuchnowski
36,440 Points

Why did you replace any files and what were those files?

In 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
Maciej Czuchnowski
36,440 Points

OK, 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.

When 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
Maciej Czuchnowski
36,440 Points

Did you set up the config/database.yml file properly for your Mysql installation? Did mysql run fine in your original project?

I'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
Maciej Czuchnowski
36,440 Points

Mysql 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.

That's unfortunate to hear, thanks for trying anyways.

Maciej Czuchnowski
Maciej Czuchnowski
36,440 Points

Another 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.

Are 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
Maciej Czuchnowski
36,440 Points

The 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.

Still no luck...