- Write Active Record Migrations
- Connect between tables using Active Record Associations
- Write class and instance methods using Active Record
- Use Active Record to query the database
The Flatiron Theater Company is holding Auditions!
An actor may only Audition for one Role, while a Role may have many Auditions for it!
run bundle install
Create your migrations.
-
Auditionsshould have an actor(string), location(string) and belong_to a role(integer) -
Rolesshould only have a character_name
| Column | Type |
|---|---|
| actor | string |
| location | string |
| phone | integer |
| hired | boolean |
| role_id | integer |
| Column | Type |
|---|---|
| character_name | string |
- What associations will this need?
- (i.e.
has_many,has_many through, andbelongs_to)
Audition#rolereturns an instance of role associated with this auditionAudition#call_backwill change the the hired attribute totrue
Role#auditionsreturns all of the auditions associated with this roleRole#actorsreturns an array of names from the actors associated with this roleRole#locationsreturns an array of locations from the auditions associated with this roleRole#leadreturns the first instance of the audition that was hired for this role or returns a string 'no actor has been hired for this role'Role#understudyreturns the second instance of the audition that was hired for this role or returns a string 'no actor has been hired for understudy for this role'
