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

HELP

Add a method called status which calls the state of the model.

MY CODE:

class UserFriendshipDecorator < Draper::Decorator
  decorates :user_friendship
 def status model.state.titleize
end

1 Answer

Methods in ruby should follow this pattern, based on your code:

def status 
model.state.titleize
end

So the full code should be:

class UserFriendshipDecorator < Draper::Decorator
  decorates :user_friendship
  def status 
     model.state.titleize
  end
end

This assumes that tour code is correct, I don't know where this exercise comes from and what exactly the code is supposed to be doing (no context), so I can't give you more help at this point.