def users_list html = '' self.users.each do |user| html << user.link_avatar_tag end html.html_safe end
I feel that it is possible to write shorter.
Is it possible get rid of the temporary variable(html)?
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It only takes a minute to sign up.Sign up to join this community
You should use
map (don't use
each to accumulate. Check this page about functional programming):
def users_list users.map(&:link_avatar_get).join.html_safe end