Hi there,

I'd be happy if someone can help me with the following:
The application is for uploading all kinds of datafiles which should be
displayed accordingly to their mimetypes.

This is the class/database hierarchy of what I want to archive:

Class:Filegroup
  has_many :binary
  Attributes are e.g. groupname, timestamps of upload/update and so on

Class:Binary
  This is the generall description of the uploaded file
  Attributes included are e.g. original_filename, mimetype and so on

If someone is uploading a file with a known mimetype, a (sub-)class
should be created with specific details about the file e.g.

Class:Image
  Including width, height...

Class:Text
  Textstyle (php, xml)...


I'd like to access the list of *all* files through something like:
Filegroup.find(xxx).files iterates over it and render it automatically
as it is specified in each of those sub-classes (so images whould be a
thumbnail, text is shown fully and binary just a simple download link)

I found the Polymorphic-attribute for the database associations but this
is the other way round, isn't it?
Also I took a look at
http://archive.robwilkerson.org/2009/08/26/learning-ruby-on-rails-file-upload/index.html
but this isn't exactly what I need because the class which should be
used should be defined automatically.
(E.g. somewhere is specified which class should be used for which
mimetype)


Thank you for your time and help.

-- 
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