jeudi 8 décembre 2016

How to wrap the returns of method to one div block

I'm creating like model in rails application. To use images in tooltip I need to wrap them all to:

<div class="tooltip">

The main method is:

  def like_user_avatars
    likes.map(&:user_avatar).map { |avatar| image_tag(avatar,
    class: "tooltip_avatars") }.join
  end

It generate something like this: <img src='...'><img src='...>. I need to wrap them all to one div block named tooltip, it should looks like <div class="tooltip"><img src='...'><img src='...></div>. I tried to add content tag :div, class: "tooltip", but it doesn't wrap everything. How can I solve my problem?

Aucun commentaire:

Enregistrer un commentaire