views:

18

answers:

0

I'm using the Rails ckeditor plugin which includes swfupload. I've also installed the paperclip plugin to handle the actual files (though I don't think it's part of the problem).

I've gotten everything working except that there's no message displayed to the user if it fails validation -- like a file is larger than the specified file size limit. Nothing happens in fact (just silently fails).

I checked the included ckeditor controller that handles the actual upload, and within the create method, I see this code block:

if @record.valid? && @record.save

    @text = params[:CKEditor].blank? ? @record.to_json : %Q"<script type='text/javascript'>
            window.parent.CKEDITOR.tools.callFunction(#{params[:CKEditorFuncNum]}, '#{escape_single_quotes(@record.url(:content))}');
          </script>"

    format.html { render :text=>@text }
  else
    format.html { render :nothing => true }
  end

Looking at this, nothing is rendered back in case of an error. Note that format.html is what runs in either case (valid or invalid record). If the record is valid, it finds that params[:ckeditor] is null so it serializes the record and sends it back as json.

If the model validation fails, swfupload debug output shows that it an event that indicates upload success.

Am I missing something simple? Or was validation never written into the plugin? If not, what needs to be done to get it working? Well, in any case I'd like to get this working. Thanks!