From 16c218ccae3aede93411d422267f2fdb7eb599d0 Mon Sep 17 00:00:00 2001 From: yanxd Date: Wed, 27 Nov 2013 14:52:36 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9A=90=E8=97=8F=E6=90=9C=E7=B4=A2=E6=A0=8F?= =?UTF-8?q?=20and=20something...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/memos_controller.rb | 1 + app/models/memo.rb | 4 ---- app/views/layouts/base_memos.html.erb | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/controllers/memos_controller.rb b/app/controllers/memos_controller.rb index 97445e72..af93c0bd 100644 --- a/app/controllers/memos_controller.rb +++ b/app/controllers/memos_controller.rb @@ -81,6 +81,7 @@ class MemosController < ApplicationController respond_to do |format| if(@memo.update_attribute(:subject, params[:memo][:subject]) && @memo.update_attribute(:content, params[:memo][:content])) + @memo.save_attachments(params[:attachments] || (params[:memo] && params[:memo][:uploads])) format.html {redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}"} else format.html { render action: "edit" } diff --git a/app/models/memo.rb b/app/models/memo.rb index 051bbe3f..9a87009e 100644 --- a/app/models/memo.rb +++ b/app/models/memo.rb @@ -8,7 +8,6 @@ class Memo < ActiveRecord::Base validates_length_of :subject, maximum: 50 validates_length_of :content, maximum: 2048 validate :cannot_reply_to_locked_topic, :on => :create - validate :content_cannot_be_blank acts_as_tree :counter_cache => :replies_count, :order => "#{Memo.table_name}.created_at ASC" acts_as_attachable @@ -50,9 +49,6 @@ class Memo < ActiveRecord::Base def cannot_reply_to_locked_topic errors.add :base, 'Topic is locked' if root.locked? && self != root end - def content_cannot_be_blank - errors.add :base, "content can't be blank." if self.content.blank? - end # def update_memos_forum # if forum_id_changed? diff --git a/app/views/layouts/base_memos.html.erb b/app/views/layouts/base_memos.html.erb index 08784c70..f1b4258e 100644 --- a/app/views/layouts/base_memos.html.erb +++ b/app/views/layouts/base_memos.html.erb @@ -31,7 +31,7 @@ 软件项目托管社区 <%= l(:label_user_location) %> : -