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_trackerusingPostGreSQLfor your database. - Don't forget to run
rake db:createto actually create the database. And make sure PostGres is running! cdinto your app, and runrails s, and checklocalhost:3000just 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
Trackmodel, that will do exactly this.