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

Mike Morales
Mike Morales
19,833 Points

Build a Simple Ruby on Rails - Problem Solved!

I figured it out, finally! It all had to do with adding the .strip.

I've been working on Build a Simple Ruby on Rails for a Month now. There are nine achievements, and I am finally there. However, I am working on the Code Challenge: Adding Gravatars. I am stuck on Challenge Task 3 of 5, here is the question given:

Update the gravatar_url method so it returns the downcased version of the email address with leading and trailing whitespace stripped. You can use the strip method on strings to do this.

I am sure it is something simple to pass. But nonetheless, I am struggling with this, and I need some hints so that way, I can move forward. Thanks, in advance!

1 Answer

This is something like what you should have from the other two code challenges. Now in this step you need to return the email with the leading and trailing white space removed. As the questions states you can use the 'strip' method to do that so the same way you do the downcase method you can chain the strip method to that and return an email that is downcase and stripped! Hoped that hint helped

class User < ActiveRecord::Base
  def gravatar_url
    return email.downcase
  end
end
Mike Morales
Mike Morales
19,833 Points

Thanks for your input. But I finally figured it out a few minutes ago. I just made the question seem harder than it actually was, I can't believe it was that simple.