Hello, i’m using the very popular attachment_fu plugin, almost
everything is awesome.
But I spend all day to make attachment_fu update a existing file with
no success.
I’m doing simple upload where my model product has_one
product_image(another model), in this product_image i call
has_attachment and everything works fine for new products. But when i
try update a product record and his image i get the error: undefined
method `uploaded_data=’ for #Product:0x679c664 , i thinking
update_attributes doesn’t work in attachment_fu when use associations.
def uploaded_picture=(picture) # used for create new product_image
associated with product
self.product_image = ProductImage.new
self.product_image.uploaded_data = picture
end
end
I read some posts about problems with attachment_fu and i think this
can be a bug.
Someone i have maded this operation using has_one association betewen
models?
I can’t do this, because my new.html.erb is a view for product model
and not for product_image, this is the reason for uploaded_picture=
method.
And the problem not is when call new but update and uploaded_picture
is used only in new.
I think the reason is because updated_data is a method for
product_image class, but even i use <%= f.file_field :uploaded_picture
%>(field for my virtual atribute uploaded_picture) in my edit view i
got errors, but this error:
undefined method `content_type’ for “Fotos-132.jpg”:String
Some one can help? How can i update existing attachment when this file
is stored in diferent table and associated with other table?
I bought Advanced Rails recipes but the chapter about upload had the
same problem.
I’ve just installed this plugin and I have problem with using with
amazon s3.
Urls are created in that way
http(s)://:server/:bucket_name/:table_name/:id/:file
instead of :
http(s)://:bucket_name.:server/:table_name/:id/:file
I can fix it manually in this place but I’m not sure if it will work
properly at all.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.