this is my view: <td align="left"> <% setupsheets_missing = true @series800.setupsheets.each do |sheet| setupsheets_missing = false %> <%= link_to( image_tag(sheet.public_filename(:small), :border=>1, :style=>"margin- right: 3p"), 'show_setup_sheet',:popup => ['sheet window', 'height=780,width=620']) %> <% end if setupsheets_missing %> <%= image_tag("/setupsheets/ missing_small.gif", :border=>1, :style=>"margin-right: 3px")%> <% end %> </td><td></td><td></td></tr>
It works, but it is damned ugly. if attachment_fu has saved multiple files, I get a list of thumb picture links if it has only saved on I get one thumb picture link if it hasn't any I get a image_tag to a thumb bearing the word "missing" I would like to replace the abomination in the view code above with: <td align="left"><%= sheet_links_for(@series800,:small) % ></td> and a helper routine: def sheet_links_for(series800,size = :small) sheets_present = false series800.setupsheets.each do |sheet| sheets_present = true link_to( image_tag(sheet.public_filename(size), :border=>1,:style=>"margin- right: 3px"), 'show_setup_sheet',:popup => ['sheet window', 'height=780,width=620']) end unless sheets_present image_tag("/setupsheets/ missing_small.gif", :border=>1,:style=>"margin-right: 3px") end end But no... the 'missing tag' does show up, but the two links are nowhere to be found. I have been trying to spot the error for the past week... been over this with a fine tooth comb, substituting image tags for the 2 links. any ideas? also is there a clean way to test for sheets present without introducing a local variable. Thanks in advance. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---