---------- Forwarded message ----------
From: Miguel Fung <[EMAIL PROTECTED]>
Date: Wed, Oct 29, 2008 at 4:20 PM
Subject: Help to show file_column image for has_many association
To: [email protected]
I have this tables association
class Product < ActiveRecord::Base
has_many :pictures
file_column :image, :magick => {
:versions => { "thumb" => { :crop => "4:3", :size => "50x50",
:quality => 65 },
"medium" => { :crop => "4:3", :size => "115x75>",
:quality => 85 },
"big" => { :crop => "4:3", :size => "450x480>",
:quality => 85 },
"home" => { :crop => "4:3", :size => "100x75",
:quility => 85} }
}
# I would like to make image a virtual field as the first picture in
the Pictures Table associated to this product
def image
return self.pictures.find(:first)
end
end
class Picture < ActiveRecord::Base
belongs_to :product
file_column :image, :magick => {
:versions => { "thumb" => { :crop => "4:3", :size => "50x50",
:quality => 65 },
"medium" => { :crop => "4:3", :size => "115x75>",
:quality => 85 },
"big" => { :crop => "4:3", :size => "450x480>",
:quality => 85 },
"home" => { :crop => "4:3", :size => "100x75",
:quility => 85} }
}
end
How to config the hotel controller to show the thumbnail of the virtual
field image ?
TIA
LFung
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---