Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

General Discussion

Adding States code challenge

Hey there. I'm on the Building Social Features in Rails > Managing Friendships > Adding States code challenge 2/2. The challenge is "Call the "block_mutual_friendship" method after the transition to the blocked state."

Right now, my code is

class UserFriendship < ActiveRecord::Base
  belongs_to :user
  belongs_to :friend, class_name: 'User', foreign_key: 'friend_id'

  state_machine :state, initial: :pending do
   after_transition on: :block, do :block_mutual_friendship
    state :requested
    state :blocked

After reading forum posts from months ago, I see that you don't need the exclamation mark like in the video, but even though I don't have that, it still says I'm wrong somehow.

2 Answers

' or "

Ah ok. Where in the code would I put those? Around block_mutual_friendship?