Weird problem with acts_as_attachment

I'm using acts_as_attachment to build a simple portfolio. Items has and
belongs to many attachments, but when using this:

<% for attachment in @item.attachments %>
  <%= %><br/>
  <%= attachment.filename %><br/>
  <%= image_tag attachment.public_filename, :size =>
attachment.image_size %>
<% end %>

in a view I get:

<img alt="Oxmo" height="536" src="/attachments/1/oxmo.png?" width="800"

the filename is fine but the id for that image is 14, so the
public_filename is all wrong! The id for the item is 1 but shouldn't in this case return the id of the attachment??

Thanks in advance!

Mikkel Bech