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

Should be easy Ruby question

I know we've gone over this in one of the ruby videos but I totally forgot and I dont want to screw up the project.

If i want to delete the users in the (seeds.rb) and delete the users in the db with their statuses and such WITHOUT deleting the structure of the database how do i do this in the console???

5 Answers

You can just remove the users from the seeds.rb file manually.

If you want to restart the database from scratch do the following:

rake db:reset rake db:schema:load

Does rake db:reset rake db:schema:load only delete the users, statuses, etc etc?? or does it also delete all those tables created?

db:reset will reset the database as specified in config/database.yml.

After that, you need to use db:schema:load which will reapply all migrations to the database. So essentially you're wiping the database, and then creating all the tables you had before.

Remember they're two seperate commands.

RIchard

Go into Rails console, and type tablename.delete_all... So for example:

User.delete_all

or

Status.delete_all

Y'all are awesome! thanks for the help