We're going to build an app that keeps track of which developers are working on which applications that our company is building. We also want to be able to track bugs that arise for a certain application!
Clone down the Sinatra ActiveRecord starter kit with the following command:
git clone https://github.com/LaunchAcademy/sinatra-activerecord-starter-kit.git
Your job is to create the migrations, models and validations necessary to have the following two models working:
- A developer must have a name and email
- A developer can optionally have a phone number
- A developer can be a part of multiple applications
- An application must have a name an a Github url
- An application can optionally have a description
- An application can have many developers working on it
- A bug must have a title/name
- A bug must have a deadline (for completion) - this should be saved as a Date object
- A bug can optionally be assigned to a developer (or can remain unassigned)
- A bug must belong to an application. (You should now update
Application
to reflect the fact that it has many bugs associated with it.)
You should feel free to create any extra model you feel is necessary to support the many-to-many association between the first two models.
Make sure to put all validations on both the database and model level!
You don't need to build out any additional Sinatra functionality - all you need to be concerned with is the contents of app/models
, db/migrate
, and db/schema.rb
!
Create a file at db/seeds.rb
that creates a number of users, applications, and bugs, all associated with each other. Make sure it works by running rake db:seed
. Open up your terminal window and run pry -r "./app.rb"
to test your models. Practice running ActiveRecord queries to find things like all of the bugs assigned to a developer, all of the developers associated with a project, etc.