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 trial

Ruby ActiveRecord Basics Migrations and Relationships Looking at our Application

Akilah Jones
Akilah Jones
18,397 Points

ActiveRecord: How do I get the updated project data?

So, I replaced my existing project with the updated project but when I reload the app in my browser, I do not see the same entries that's shown in the video (I still only see the two entries we manually entered per previous videos).

The instructor doesn't cover how to update the project, so I just assumed a copy and replace would suffice, but perhaps I'm a missing a step or few...

...OR do the project files only contain the schema and no data is actually generated from these files?

Thanks

AJ

P.S. If it's the latter, may I please suggest that a moderator tag the instructor......in hopes that he'd consider possibly adding some "Instructor Notes" to the video, giving a summary of what data he added or perhaps even a csv for each table.

2 Answers

Hampton Catlin
STAFF
Hampton Catlin
Treehouse Guest Teacher

Oh, that's a really good point! We can add some seed data or something to the project.

Until then, the test entries you have shouldn't stop you working along with the course, even if the data is a little different.

Akilah Jones
Akilah Jones
18,397 Points

Thanks for the response! I appreciate it...

And yes, you're right I've been able to follow along just fine. I stopped as soon as I saw the difference, but after some time decided to continue and realized the difference didn't matter (or at least it hasn't yet).

Adding seed data, at some point, would be great though!

Thanks again

AJ

Hi,

i imported the data using following statements.

Connect to mysql

mysql -u root

Use database

use biller_development;

Execute SQL-script

source /path/to/project/dump.sql;

Hope that helps.

Hi Onur Akpolat :

Could you be a bit more specific about how you did this? Did you just copy dump.sql from the download into your biller folder before you executed these commands?

I ask because I tried to do it, and now things are super messed up. rake db:migrate isn't working, and I'm getting a screen like this when I try to run the server:

gahhh

I'm concerned that I just lost most of the work I did today, actually. :frowning:

Oh hey! So I ended up having to basically redo my database, as detailed over here.

Good news: Once I used your commands (edited a bit; see below!) it worked!

For me, once I was in the project folder, I had to do the following.

First, I can only get mysql to work properly in my terminal by running it this way:

mysql -u root -p

Then, once in the mysql> prompt, I did your suggestion of:

use biller_development

Finally, to clarify for those who might be confused like I was, i had to include the path to the downloaded dump.sql file. In my case, it looked this way (since my user name is TCB):

source /Users/TCB/biller/dump.sql;

Tip for Mac OS X users: if you need the source path, you can drag the file's icon to your terminal window.

Thanks again, Onur!

Thanks Onur, this worked perfectly for me!