List Info

Thread: linking pictures to a model




linking pictures to a model
user name
2007-12-31 14:28:29
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
--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-talkgooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: linking pictures to a model
user name
2007-12-31 18:53:48
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://cl
arkware.com/cgi/blosxom/2007/02/24

On Dec 31, 3:28 pm, jvazquez <Juanvazq...gmail.com> wrote:
> 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
--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-talkgooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )