I'm talking half-ruby half-english in the following paragraph
I have Person
s and I have 'Pet's. Person
has_many
Pet
. I have a table of Person
s displayed with pets included in the cell, like:
def pets_column(record)
if record.pets.count == 0
'no pets'
else
record.pets.collect{|p| html_escape(p.to_label) }.join('<br />')
end
end
It is displayed correctly and it is a link which displays a nested table for the pets.
I want to decide that it should be a link or not on a per record basis according to some condition. For example if record_frozen_at is not null
then the Pet
list of the record also must be frozen. (No addition, no removal, no update for those pets)
(The columns[:pets].clear_link
does it for the whole table not on a per record basis.)