Today we're going to build a simple, single model CRUD application in Rails using PostGres. We're going to be building a music tracking app to store our favorite songs, and artists.
- Create a new directory somewhere on your computer, and whip up a new rails app called
music_tracker
usingPostGreSQL
for your database. - Don't forget to run
rake db:create
to actually create the database. And make sure PostGres is running! cd
into your app, and runrails s
, and checklocalhost:3000
just to make sure everything is working. Afterwards make sure to kill the server(ctrl c)
before moving on so we can do some work.
- Since our app will need to track our favorite tunes, we'll need a model to store this information. So let's create a
Track
model, that will do exactly this.