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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 On Dec 31, 3:28 pm, jvazquez <Juanvazq...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 Henry <nicholas.he...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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 > > On Dec 31, 3:28 pm, jvazquez <Juanvazq...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi all, I am new torubyand as such really new torails, 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 manypictures > > to a model "house". That way if I look up my house, I will see all the > >picturesthat 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---