From 7068359e9e6832cb9a1eb7b28982a07f167f8537 Mon Sep 17 00:00:00 2001 From: yanxd Date: Thu, 19 Dec 2013 16:04:01 +0800 Subject: [PATCH] attachment.nil? --- app/views/attachments/upload.js.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/attachments/upload.js.erb b/app/views/attachments/upload.js.erb index ade73ab23..4761f4635 100644 --- a/app/views/attachments/upload.js.erb +++ b/app/views/attachments/upload.js.erb @@ -1,5 +1,5 @@ var fileSpan = $('#attachments_<%= j params[:attachment_id] %>'); -<% if @attachment.new_record? %> +<% if(!@attachment.nil? && @attachment.new_record?) %> fileSpan.hide(); alert("<%= escape_javascript @attachment.errors.full_messages.join(', ') %>"); <% else %>