i have a problem:
undefined method `avatar_url' for #<User:0x000000040783a8>
controller:
class ApplicationController < ActionController::Base
protect_from_forgery
helper :all
helper_method :avatar_url
protected
def avatar_url(user)
if user.avatar_url.present?
user.avatar_url
else
default_url = "#{root_url}images/guest.png"
gravatar_id = Digest::MD5.hexdigest(user.email.downcase)
"http://gravatar.com/avatar/#{gravatar_id}.png?s=48&d=#{CGI.escape(default_url)}"
end
end
end
in view:
...
<%for user in @users %>
<%= image_tag avatar_url(user) %>, username: <%= user.username %>, e-mail: <%= user.email %>
<% end %>
...
Someone help me?