Skip to content

Instantly share code, notes, and snippets.

@cmkoller
Last active September 10, 2015 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmkoller/0c5ccfa56c978fdf5cf0 to your computer and use it in GitHub Desktop.
Save cmkoller/0c5ccfa56c978fdf5cf0 to your computer and use it in GitHub Desktop.
Systems Check Practice 9-10

Systems Check Practice - ActiveRecord 9-10

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!

Instructions

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:

Developers

  • 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

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

Bugs

  • 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.)

Tips

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 seeder

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment