Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Setting up the state machine

Hey, I'm on the video titled 'settling up the state machine', my tests were looking good and matching up with Jasons until this line of code

after_transition on: :accept, do: :send_acceptance_email

After which i began getting 3 errors when testing. Here is on of the errors

test: #accept! should send an acceptance email. (UserFriendshipTest):
NoMethodError: undefined method `friend_request_accepted' for UserNotifier:Class

any thoughts??

2 Answers

Just to specify the line of code written was in the user_friendship.rb file.

state_machine :state, initial: :pending do
    after_transition on: :accept, do: :send_acceptance_email

Thanks

Nevermind I went back through the video and found it. If anyone has this problem, around 4 minutes in the video jason pastes previous code we used and changed a couple things on the screen but must have changed a few more things that the video doesn't show...