I followed this excellent example from NovaWave (thank you!) and
implemented a mini-email system
Next I wanted to add the ability to attach different models to the
email. For this I created a model called attachment that belongs to the
message and has polymorphic relationships with a couple of other models
(pretty cool ehh, OLE eat my dust)
What I can't figure out is when/where/how to initiate the attachment. I
can test this out and it works just fine
Attachment.new(:attachable => Item.find(:first), :message =>
and the attachable_type sets correctly, etc.
My problem is that I still don't understand REST well enough to figure
out where this belongs in the grander scheme of things. Here are some
options that I'm considering:
1. New actions one for each attachment type that all point to the same
action under the sent_controller (see the novawave doc). I think the
url would look like this: /sent/new/item/4546
2. Member actions under each attachable model that would look like this
3. Multipart form?
4. Somewhere as part of current_user.sent_messages.build
For once, I'd like to do things the proper RoR way.
Thank you kindly.