Displaying 1 result from an estimated 1 matches for "new_main_image".
2006 Feb 28
1
adding to errors in controller?
def update
@product = Product.find(params[:id])
@product.attributes = params[:product]
if params[:main_image]
image = Image.new params[:main_image]
if image.save
@product.main_image.destroy if @product.main_image
@product.main_image = image
else
@product.errors.add_to_base(image.errors.full_messages.join(", "))
end
end