Dear Peter Vandenabeele,

thanks for your really long answer and sorry for my late reply.. I'm
really short on time these days.. :(

A day before you wrote your answer I came up with a different solution:

http://noxx.penya.de/ruby-attachments.txt
This is the "main class" which was the binary in my first post. This
class handles the upload (payload) and creates subclasses depending on
the mimetyp.

If e.g. an image was uploaded it builds this class:
http://noxx.penya.de/ruby-images.txt
Images have some more attributes as width/height in the database table
so it's possible to search through them.

The general binary class for all other or - in my case also the image
file itself and the created thumbnail - is represented by this class:
http://noxx.penya.de/ruby-binaries.txt
Binaries handles all files and also the deletion if something is
destroyed.

Thus, the binary can belong directly to the attachment or upload itself
if the mimetyp is not recognized or as the "data" of the image.

I splitted image/binary and so on because if I save it all in one table
I have many NULL-rows and it's hard to handle.

But it should be easy to extend, too...

In the end I can call @attachments.all, get back all the uploaded files
as the specific class and let the render choose which view to display.


I hope I could give you an impression of my solution and maybe you have
some suggestions what would be good to improve.

Thanks for your time and again for your reply, too.
Greetings.

-- 
Posted via http://www.ruby-forum.com/.

-- 
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 [email protected].
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.

Reply via email to