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
Unsubscribed User
8,167 PointsShould 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
Richard Crawford-Wilson
6,094 PointsYou 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
Unsubscribed User
8,167 PointsDoes rake db:reset rake db:schema:load only delete the users, statuses, etc etc?? or does it also delete all those tables created?
Richard Crawford-Wilson
6,094 Pointsdb: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
Brandon Barrette
20,485 PointsGo into Rails console, and type tablename.delete_all... So for example:
User.delete_all
or
Status.delete_all
Unsubscribed User
8,167 PointsY'all are awesome! thanks for the help