Displaying 4 results from an estimated 4 matches for "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
if @product.errors.e...
2006 Feb 28
1
ArgumentError (string contains null byte) -- file upload problem
Hi,
Controller code:
if params[:main_image]
image = Image.new
image.blob = params[:main_image].read
@product.main_image.destroy if @product.main_image
@product.main_image = image
end
When I try to display the image using send_data, I get the following error:
ArgumentError (string contains null byte):
.//vend...
2005 May 23
1
has_and_belongs_to_many dual insert error ?
...turn self.tag == other.tag end
def <=>(other) return self.tag <=> other.tag end
end
Controller
----------
class PhotoController < ApplicationController
def save
pict = @params[''picture'']
picture = Picture.new
picture.original = main_image
picture.title = pict[''title'']
picture.body = pict[''body'']
picture.author = author
# Adding these lines prevents the problem from
# occuring:
# picture.save
# picture.reload
picture.update...
2006 Apr 02
7
RANT: belongs_to -> refers_to
Every once in a while, I pipe up and whine that "belongs_to" should really
be ''refers_to" [http://dev.rubyonrails.org/ticket/2130]. It''s time again.
I''ve got a bunch of stuff going onto eBay, so, like any good engineer, I
don''t just post it manually: I design a Rails-based inventory database that
creates a semantically-correct XHTML/CSS auction