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

UserNotifier - Undefined method

I'm trying to create my own rails app so I've been re-doing some of the videos using rails 4. I've currently trying to add user friendships but I'm stuck. The problem occurs when I'm trying to accept a friendship. I keep getting the error

undefined method `friend_request_accepted' for UserNotifier:Class.

The method that it is referencing is:

def send_acceptance_email
  UserNotifier.friend_request_accepted(id).deliver
end

As far as I'm aware as it's against UserNotifier the method friend_request_accepted is automatically created when I created the file friend_request_accepted.html.erb because it's just sending that document. So why would it not be found?

1 Answer

How silly do I feel! I've spent ages looking over this and just noticed the method had a different name in the user.notifier.rb!