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
appreciated.
Thanks
-J

Something like this will work:

class House < ActiveRecord::Base
has_many :photos
end

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

validates_as_attachment
end

you will need the attachment_fu plugin. A good tutorial on it here:
http://clarkware.com/cgi/blosxom/2007/02/24

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

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