diff --git a/app/controllers/dmsf_detail_controller.rb b/app/controllers/dmsf_detail_controller.rb index 40b5d26c..2338377b 100644 --- a/app/controllers/dmsf_detail_controller.rb +++ b/app/controllers/dmsf_detail_controller.rb @@ -129,7 +129,8 @@ class DmsfDetailController < ApplicationController @file.name = @revision.name @file.folder = @revision.folder - if @revision.save && @file.valid? + if @revision.valid? && @file.valid? + @revision.save! unless file_upload.nil? @revision.copy_file_content(file_upload) end diff --git a/app/models/dmsf_file.rb b/app/models/dmsf_file.rb index 39dc566a..45cfb298 100644 --- a/app/models/dmsf_file.rb +++ b/app/models/dmsf_file.rb @@ -43,7 +43,7 @@ class DmsfFile < ActiveRecord::Base def validates_name_uniqueness existing_file = DmsfFile.find_file_by_name(self.project, self.folder, self.name) - errors.add(:name, "has already been taken") unless + errors.add(:name, l("activerecord.errors.messages.taken")) unless existing_file.nil? || existing_file.id == self.id end