Help with improving images

0 views
Skip to first unread message

upisdown

unread,
Feb 21, 2011, 8:52:37 AM2/21/11
to substruct
I'm trying to add captions to images and have been struggling with
editing the admin/product_controller to update my caption.

I have added the column, added the method, added the form box which
correctly loads the text, however when I try to save it - it simply
does not work. I feel I have tried every variation possible to try to
save the params. I would really appreciate help and hopefully the
answer will help other people as well.

## This actually saves to the caption but only when it is created
unless params[:image].blank?
params[:image].each do |i|
if i[:image_data] && !i[:image_data].blank?
new_image = Image.new
new_image.caption = "test"
logger.info i[:image_data].inspect
new_image.uploaded_data = i[:image_data]
if new_image.save
@product.images << new_image
else
image_errors.push(new_image.filename)
end
end
end
end


I have tried

@product.images[0].caption
@image.caption
params[:image].caption
i[:image_data].caption
pi = ProductImage.find(
:first,
:conditions => ["image_id = ? AND product_id = ?",
params[:image_list][i], params[:id]]
)
pi.caption

and none of them work. For testing purposes I tried to setting the r-
value to "test".

I would really appreciate any help.

Roger Pack

unread,
Feb 23, 2011, 11:01:20 PM2/23/11
to subs...@googlegroups.com
what error message and what is in the logs, error wise?


--
You received this message because you are subscribed to the Google Groups "substruct" group.
To post to this group, send email to subs...@googlegroups.com.
To unsubscribe from this group, send email to substruct+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/substruct?hl=en.


Reply all
Reply to author
Forward
0 new messages