Forum: Ruby on Rails has_images

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
9046f1681dc8375fd81b34799d5abd36?d=identicon&s=25 Jeff Smick (sprsquish)
on 2005-12-28 01:49
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

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 is optional and would default to

Retreval for an image tag would go something like

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

8a456610e31c8feadc4cef71d9347cbd?d=identicon&s=25 Craig Ambrose (Guest)
on 2005-12-28 02:41
(Received via mailing list)
9046f1681dc8375fd81b34799d5abd36?d=identicon&s=25 Jeff Smick (sprsquish)
on 2005-12-28 02:46
Craig Ambrose wrote:

HA! beautiful! thank you
This topic is locked and can not be replied to.