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

Deleting all users and statuses

what are the commands to delete all users and statuses from my databases, I feel like this is what is giving me some issues with using

<%= @status.user.full_name %>

It's saying there's no method for 'full_name', but there certainly is

2 Answers

Brandon Barrette
Brandon Barrette
20,485 Points

In the rails console, you can run:

Status.delete_all

That will delete all statuses from the database.

Likewise,

User.delete_all

Will delete all the users.

Thank you, this is what I needed.. I don't know what's going on but something doesn't have a value so it's throwing the whole database..hopefully this will solve it

Yeah, deleting all Statuses and Users using the console fixed the problem

Tony McKeown
PLUS
Tony McKeown
Courses Plus Student 14,300 Points

If you want to delete the whole database I think (off the top of my head) you could enter rake db:reset

This link seems to discuss various commands on your database.

http://stackoverflow.com/questions/10301794/difference-between-rake-dbmigrate-dbreset-and-dbschemaload

Thank you.. just to be sure, the database/db is what's holding user accounts, statuses, and everything else right?