The purpose of this respository to practice SQL and ActiveRecord in the Rails console and directly with the database. Follow along with Part 1 and Part 2 of my tutorial. This project uses PostgreSQL and Ruby on Rails to build a seeded database of Hogwarts School of Witchcraft and Wizardry enrollment data.
You must have the following installed before beginning: Rails, PostgreSQL and Bundler.
Initial setup must be done before interacting with the database. After cloning this repository, run the following commands in the CLI:
$ Accio, database!
Just kidding:
$ bundle install
$ rake db:{create,migrate,seed}
To practice ActiveRecord queries or run existing ActiveRecord methods on the Student, Enrollment, Subject and Teacher models, connect to the Rails console:
$ rails c
To practice SQL queries, connect directly to the database:
$ rails db
Ellen Cornelius. Check out more blog posts at ellencornelius.com