$ createdb tunr_db
$ psql -d tunr_db < db/schema.sql
- Create an app.rb file for this application
- Create a Gemfile using
bundle init
- Create a folder for your models (it should be called
models
) - Create a file that will contain your AR class definition for 'artists'
- Add your dependencies into the Gemfile and then run
bundle install
- Define your artist model in
models/artist.rb
- Require your dependencies in
app.rb
- Establish connection to database using AR
- Load pry at the end of
app.rb
Remember to seed your database before running the commands below
$ psql -d tunr_db < db/seeds.sql
In the console:
- Find all artists
- Find just one artist by id
- Find Taylor Swift (or your other fav artist) by name.
- Find all artists from the USA
- Find all artists NOT from the USA
- Create a new artist for your favorite artist
- Change at least 2 of their attributes
- Destroy the artist you just created
- (NOTE: If you destroy other artists at this point, you'll need to reseed your data for consistency.)
- Create a file that will contain your AR class definition for Songs
- Make sure to link that file in your main application file
- Add corresponding associations to your models
In the console...
- Find the artist with the name Enya
- Use AR methods to find all of Enya's songs, store them in a variable
- Get the first song out of those results and get that song's title
- Find the song with the title 'Unstoppable' and store in a variable
- Get that song's artist, store that in a variable
- Reassign the song's artist to be a different one (your choice)
- Save that song
- Create a new song, and associate it with a different artist of your choice
- Delete that song
- Find all of Enya's songs again, store in a variable
- Using
each
, iterate over those songs and for each song, print "I like" + the song name