Hello,
I followed the tutorial at: http://khamsouk.souvanlasy.com/2007/5/1/ajax-file-uploads-in-rails-using-attachment_fu-and-responds_to_parent
However, in my controller I am getting the error:
NoMethodError (undefined method `size=' for #<SwfImage:0x5705b48>)
Other references to this error indicate that the render method is trying to render a string (which does have a size method) but it's attempting to render the SwfImage object instead. So how would I get around this? Any help would be appreciated.
#### VIEW CODE ####
<% form_for(:swf_image, :url => formatted_swf_images_path(:format => 'js'), :html => { :multipart => true, :target => 'upload_frame' }) do | f> %> <p> <b>Filename</b><br /> <%= f.file_field :uploaded_data %> </p>
<p> <%= f.submit "Create" %> </p> <% end %> <iframe id="upload_frame" name="upload_frame" style="width:1px; height: 1px; border:0px;" src="about:blank"></iframe>
#### CONTROLLER CODE ####
def create @swf_image = SwfImage.new(params[:swf_image])
respond_to do |format| if @swf_image.save flash[:notice] = 'Image was successfully saved.' format.html { redirect_to(@swf_image) } format.js do responds_to_parent do render :update do |page| page.insert_html :bottom, "swf_images", :partial => 'swf_images/image', :object => @swf_image page.visual_effect :highlight, "image_#{@swf_image.id}" end end end else format.html { render :action => "new" } format.js do responds_to_parent do render :update do |page| # do nothing end end end end end end