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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Jason Breitigan](https://secure.gravatar.com/avatar/bde016c74230ddb2e7941d94c5658f59?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Jason Breitigan
15,074 PointsCreating Model Methods
This is what I have based on the video:
class User < ActiveRecord::Base has_many :user_friendships has_many :friends, through: :user_friendships
has_many :pending_user_friendships, class_name: 'UserFriendship', conditions: { state: 'pending' } has_many :blocked_user_friendships, class_name: 'UserFriendship', conditions: { state: 'blocked' }
has_many :pending_friends, through: :pending_user_friendships has_many :blocked_friends, through: :blocked_user_friendships
def has_blocked?(other_user) blocked_friends.include?(other_user) end
end
I entered it like the video shows but it doesn't pass and the information I gained on another thread about this challenge didn't work for me. Any one have any idea what the deal is with this?
1 Answer
![Kang-Kyu Lee](https://secure.gravatar.com/avatar/873e6fd319032200fd5dc359f5d897eb?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Kang-Kyu Lee
52,045 PointsI just passed after edited from the above, source: :friend
at the end of has_many :blocked_friends
line. But I don't know why? I tried to find out from documentations, but still not clear. So I am just going to ask our teacher Jason Seifer
Or this might be just a broken part... https://teamtreehouse.com/forum/challenge-task-2-blocked-friends