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) %> : -