RailsCasts Pro episodes are now free!

Learn more or hide this

Dreven's Profile

GitHub User: Dreven

Comments by


If it helps anyone, this is what I ended up with in my RJS file - assuming I had hidden 'folder_notice_success' and 'folder_notice_fail' divs above the form and I had a simple form that could only possibly return one error. I need to clean this up (and I have no idea what I'm doing), but it seems to work great. I'm also calling a Javascript function in the view that uses and AJAX call to refresh a list of folders (since this is all from a form_remote that creates a new folder). But, I'm only calling that function if the @folder.save was successful:

    respond_to do |format|
       if @folder.save
          flash[:notice] = "New folder successfully created!"
          format.html { redirect_to 'new' }
          flash[:error] = "doesn't matter right now as long is something is here."
          format.html { redirect_to 'new' }

if !flash[:notice].blank?
    page[:folder_name].value = ''
    page.replace_html :folder_notice_success, flash[:notice]
    page.delay(3) do
    page << "folder_lookup()"
elsif !flash[:error].blank?
    page.replace_html :folder_notice_fail, 'ERROR: ' + @folder.errors.to_xml
    page.delay(4) do