Adding State
It is important to be able to respond to different events in our friendship model. For example, when a user sends a friend request to another user, we want the requestee to get an email. We're going to use something called a state machine to manage this.
6 videos • 5 quizzes • 0 code challenges
-
Play
Preview
What is a State Machine?
13 minutes 48 seconds
-
ABC
Preview
Quiz: What is a State Machine?
5 questions
-
Play
Preview
Setting Up The State Machine
15 minutes 13 seconds
-
ABC
Preview
Quiz: Setting Up The State Machine
5 questions
-
Play
Preview
Test Factories
15 minutes 32 seconds
-
ABC
Preview
Quiz: Test Factories
5 questions
-
Play
Preview
Accepting Friendships
13 minutes 51 seconds
-
ABC
Preview
Quiz: Accepting Friendships
2 questions
-
Play
Preview
Mutual Friendship
17 minutes 28 seconds
-
Play
Preview
Destroying Friendships
14 minutes 14 seconds
-
ABC
Preview
Quiz: Working with Friendships
4 questions
Try converting the state machine to use an integer instead of a string for the state field. This is going to involve creating a migration as well as significantly modifying your code.