You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
asciinema.org/app/decorators/user_decorator.rb

23 lines
419 B
Ruby

class UserDecorator < ApplicationDecorator
decorates :user
def nickname
"~#{user.nickname}"
end
def asciicasts_count
model.asciicasts.count
end
def link(options = {})
text = block_given? ? yield : nickname
h.link_to text, h.profile_path(user), :title => options[:title] || nickname
end
def img_link(options = {})
link(options) do
h.avatar_image_tag(user)
end
end
end