Results 1 to 2 of 2
Feb 13, 2009, 10:59 #1
- Join Date
- Apr 2006
- 0 Post(s)
- 0 Thread(s)
Access child validation attachment_fu
I'm using attachment_fu for image uploading. I have a class Photo and class Image, Photo has_one :image.
The reason I'm doing this is because my photos are sortable with a position attribute, and if I just have this position attribute on the image, it makes a db call for each image AND thumbnail that I create with attachment_fu. It's a little db intesive, so I just maintain the position in the Photo class and reference Image.
The only problem is, the validations specified in my has_attachment statement in Image, don't actually work when I call Photo save. Here's my code:
@photo = Photo.new @image = Image.new(:uploaded_data => params[:photo][:file]) @photo.image = @image if @photo.save redirect_to @photo
How can I access the validators of the child class Image to test this when saving the photo.
I tried saying
if @photo.save && @image.save