- 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.
-
Auditions
should have an actor(string), location(string) and belong_to a role(integer) -
Roles
should 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#role
returns an instance of role associated with this auditionAudition#call_back
will change the the hired attribute totrue
Role#auditions
returns all of the auditions associated with this roleRole#actors
returns an array of names from the actors associated with this roleRole#locations
returns an array of locations from the auditions associated with this roleRole#lead
returns 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#understudy
returns 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'