Why it does not display the correct object?

Here is the partial:

%tr
%td
= company.name
- unless company.reports.nil?
= link_to image_tag(“alert.png”), “#company_reports”, :class =>
“reports”
%td
- company.categories.each do |category|
= link_to category.name, category_path(category)
- unless category == company.categories.last

%td= link_to t(‘Show’), company
%td= link_to t(‘Edit’), edit_company_path(company)
%td= link_to t(‘Destroy’), company, :confirm => ‘are_you_sure’,
:method => :delete

%div(style=“display: none;”)
#company_reports
= company.name

When I click in the link with image “alert.png” is displayed the name
of another company but not the current company.
Why?

On Dec 11, 12:12am, Mauro [email protected] wrote:

  • unless category == company.categories.last
    When I click in the link with image “alert.png” is displayed the name
    of another company but not the current company.
    Why?

Presumably you’ve got some JavaScript that shows divs in response to
these clicks. All of these divs have the same id, so the browser isn’t
going to know which one to show

Fred