In search result drop box: add given name next to username

Thank you @fantasticfears
I was able to create a new Serializer specific for search and use it in place of BasicUserSerializer and look like is working.. in all the pages.

This is how my SearchResultUserSerializer look like:

class SearchResultUserSerializer < ApplicationSerializer
  attributes :id, :username, :avatar_template, :name

  def avatar_template
    if Hash === object
      User.avatar_template(user[:username], user[:uploaded_avatar_id])
    else
      user.try(:avatar_template)
    end
  end

  def user
    object[:user] || object
  end

end

Does it make sense? (again, no experience with Ruby/RoR so not sure if is ok to simply get rid of include_name? method)

If the serializer is good, the style now look like this:

3 лайка