mercredi 9 février 2022

how to change a profile pic hash value in ruby on rails

when we change the profile pic the hash key value is not changing remaining same for all the changed images, due to this cache issue profile pic is not getting change immediately.

def link_to_profile_header(user)
  if user.avatar.exists?
    image_tag(user.avatar.url(:medium), :alt => user.display_name, :class=>"img-circle nav-profile-pic")
  else
    content_tag(:div, user.first_name[0,1].capitalize + "" + user.last_name[0,1].capitalize, :class=>"circle-new #{random_class_name_for_user_default_image}")
  end
end

Aucun commentaire:

Enregistrer un commentaire