See other replies for the right technique. One comment I'll make is to
note in particular that ERb delimiters are not reentrant. To insert a
string conditionally, you could do something like this:
<%= "<a href=#{url_for_file_column('announcement','image)}" if
@announcement.image.nil %>
and if the "if" fails, the whole expression will be nil, which will be
interpolated as an empty string. It's not generally the best way to do
it, though; the separate <% if %> ... <% end %> things are better,
because they're easier to parse visually and also they don't
interpolate anything, not even an empty string. Also, the if-modifier
is fragile; it won't be happy if you break the line before it. I would
mainly use the above technique for short things like:
<%= @user.middle_name %>
where I can go ahead and do the interpolation without really caring
whether the value is nil or not (or "" for that matter). Except what
I'd really do is write a User#whole_name method But you see the
point.