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

Default Avatar for new users.

Hey guys, I am currently watching the rails tutorials on how to set up avatars via paperclip. Now Jason uses Gravatar as an alternate to show images if a user has not uploaded one yet. I don't want to use gravatar but a default "missing.png" to show up. I've got the helper method from the tutorial and changed the gravatar tag with me default_url tag, but nothing happens:

def avatar_profile_link(user, image_options={}, html_options={})

avatar_url = user.avatar? ? user.avatar.url(:thumb) : user.avatar.url(:default_url)

link_to(image_tag(avatar_url, image_options), userpage_path(user.username), html_options)

end

In my paperclip styles I have :default_url => "missing.png" and pasted the png into my assets/images folder. Any idea what I have done wrong?

greetz

1 Answer

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Hey Kelvin Liebertz you may need to specify a full path to the "missing.png" file, such as /assets/missing.png.