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

No data in database after GitHub clone.

Hey everyone,

I'm having a problem. I am trying to clone a GitHub repo to a new installation of Ubuntu. I have everything setup and the clone went fine, I think. But, when I access the app, there is no data in it. I can't log in and I can't see the Statuses that have been posted. I have run rake db:migrate and nothing happens.

I am following the Cloning the Project video here: http://teamtreehouse.com/library/programming/build-a-simple-ruby-on-rails-application/frontend-development/cloning-the-project

Any ideas?

Thanks! Jonathan

Database is not transfered, so you need to create it

rake db:setup

or migrate it (if it has already been created).

rake db:migrate

See this link about the possible things to run: http://stackoverflow.com/questions/10301794/difference-between-rake-dbmigrate-dbreset-and-dbschemaload

Thank you for the reply, but I couldn't get it to work. I created the app on my Mac Mini and am wanting to work on it on my laptop running Ubuntu. I have done a git pull and everything seems to be there. When I start the server and go to localhost:3000, everything loads up except for the statuses. I click "Post a New Status" and it tells me to log in. When I try to use the email address and password I created previously (on my Mac), it says "Invalid email or password." This tells me that none of the data from the database is loading.

Did you also run bundle install? You need to make sure your gems are installed (like Devise for logging in and whatnot)

Also, make sure you have the same ruby version (1.9.3) and rails version on each computer. I imagine you would run into some troubles as features are depreciated/changed when versions of each of these are updated.

Yes. I ran bundle install already. I did it again for sanity purposes. haha. Still nothing. Rails and Ruby versions match on each machine. This is craziness.

2 Answers

Did you create those accounts on this computer? Or your mac mini?

Your database entries from your other computer won't transfer. I recommend creating a seeds.rb file and you can manually put in users, statuses, etc. Jason shows how to use that in the 3rd video series, first video (advanced social features).

Here's a how-to on making a seed.rb file: http://xyzpub.com/en/ruby-on-rails/3.2/seed_rb.html

This way, when you switch computer, you can just setup your database (and this seeds file will populate it with the same users, statuses, friendships, etc).

Thank you so much for working through this with me. This answers my questions.

I didn't realize I had to setup the accounts on each computer since the db entries would not transfer. Now that I think about it, I remember either Jim Hoskins or Jason Seifer saying something about this and then saying we would talk about a solution for this later.

Also, thanks for the tutorial on seed.rb.

did you try running rake db:create ?

Thank you for the reply. I tried this already and it didn't help.

Have you tried creating a new status from the console just as a sanity check?

Thanks again. Please see above discussion with Brandon. I am able to create a status if I create a new account. None of the accounts I have created previously are showing.

Did you create those accounts on this computer? Or your mac mini?

Your database entries from your other computer won't transfer. I recommend creating a seeds.rb file and you can manually put in users, statuses, etc. Jason shows how to use that in the 3rd video series, first video (advanced social features).

You're the man. This answers my question. Can you post this as an "answer" and I will mark it as best answer? :-D