<% if current_user = _current_user %>
<div class="user_info">
  <%if not defined?(Company) then%>
    <%= image_tag "#{request.ssl? ? "https://secure" : "http://www"}.gravatar.com/avatar/#{Digest::MD5.hexdigest current_user.email}?s=30", :alt => "" %>
  <%else%>  
    <% 
      company = Company.fetch(current_user.company_id)
      if company and company.logo_image.file? then
        avatar = company.logo_image.url(:thumb)
      else
        avatar = "rails_admin/no_image_icon.png"
      end
    %>  
    <%= image_tag avatar, :alt => "" %>
  <%end%>
  <ul>
    <li>
      <strong><a href="#"><%= current_user.email %></a></strong>
    </li>
    <li class="desc">
      <a href="<%= main_app.destroy_user_session_path%>"><%= t("admin.credentials.log_out")%></a>        
    </li>
  </ul>
</div>
<% end %>
<% if current_user = _current_user %>
<div class="user_info">
  <%if not defined?(Company) then%>
    <%= image_tag "#{request.ssl? ? "https://secure" : "http://www"}.gravatar.com/avatar/#{Digest::MD5.hexdigest current_user.email}?s=30", :alt => "" %>
  <%else%>  
    <% 
      company = Company.fetch(current_user.company_id) if current_user.company_id
      if company and company.logo_image.file? then
        avatar = company.logo_image.url(:thumb)
      else
        avatar = "rails_admin/no_image_icon.png"
      end
    %>  
    <%= image_tag avatar, :alt => "" %>
  <%end%>
  <ul>
    <li>
      <strong><a href="#"><%= current_user.email %></a></strong>
    </li>
    <li class="desc">
      <a href="<%= main_app.destroy_user_session_path%>"><%= t("admin.credentials.log_out")%></a>        
    </li>
  </ul>
</div>
<% end %>
Fix root user's company association when its current company is deleted
CMOSD-670: Fix root user's company association when its current company is deleted
