Out of curiosity: is anyone working on something like a "has_images"
association? As in it would be able to handle images at the model level.
Not neccissarily hold them in a DB, but as flat files, as part of the
filesystem.
I''m continually finding myself in need of something like this. A way of
associating an image or a set of images to a model.
I''m starting on it now, but I need help, I really have little idea what
I''m doing right now.
How I''m seeing it, it would act just like any other association. All
that would go into the model itself would be something like:
has_images :type => ''jpg'', :labels => {:small =>
''10x10'', :medium =>
''30x30'', :not_quite_large => ''40x40''},
:directory => ''''
:type would default to png
:labels would be totally arbitrary, you could set as many or as few as
you wished. none would leave the file alone and just drop it into the
directory
:directory is optional and would default to
''public/images/#{model_name}/#{label}''
Retreval for an image tag would go something like
model.images.small
model.images.not_quite_large
As I said, I''m more than happy to be the guy hacking this out, but I
need to talk to someone willing to explain the inner workings of model
associations.
Thanks,
--Jeff
--
Posted via http://www.ruby-forum.com/.