Linking pictures to a model

Hi all, I am new to ruby and as such really new to rails, I was
wondering if anyone could help me out or point me in the right
direction. I am wanting to know the proper way to link many pictures
to a model “house”. That way if I look up my house, I will see all the
pictures that are associated with it. Any help would be greatly

Something like this will work:

class House < ActiveRecord::Base
has_many :photos

class Photos
has_attachment :content_type => :image,
:storage => :file_system,
:max_size => 500.kilobytes,
:resize_to => ‘320x200>’,
:thumbnails => { :thumb => ‘100x100>’ }


you will need the attachment_fu plugin. A good tutorial on it here:

Once it is saved, how then do I display the picture, since it is not
in the model…per se?

On Dec 31 2007, 6:53 pm, Nicholas H. [email protected]