summaryrefslogtreecommitdiffstats
path: root/app/controllers/application_controller.rb
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-03-02 19:26:03 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-03-02 19:26:03 +0000
commit0fd7e2d696cf2d94da8b4cbcdb8fa4b36eb395fd (patch)
treed2e93da10c1c871b04783dccfd56f92ec0ef502a /app/controllers/application_controller.rb
parent81d617cd5b97a811503282a5a5d056fa5b3adc0f (diff)
downloadredmine-0fd7e2d696cf2d94da8b4cbcdb8fa4b36eb395fd.tar.gz
redmine-0fd7e2d696cf2d94da8b4cbcdb8fa4b36eb395fd.zip
Refactor: Moved ApplicationController#attach_files to the Attachment model
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3523 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r--app/controllers/application_controller.rb21
1 files changed, 0 insertions, 21 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 4cc671396..c2fd2c2f5 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -257,27 +257,6 @@ class ApplicationController < ActionController::Base
self.class.read_inheritable_attribute('accept_key_auth_actions') || []
end
- # TODO: move to model
- def attach_files(obj, attachments)
- attached = []
- unsaved = []
- if attachments && attachments.is_a?(Hash)
- attachments.each_value do |attachment|
- file = attachment['file']
- next unless file && file.size > 0
- a = Attachment.create(:container => obj,
- :file => file,
- :description => attachment['description'].to_s.strip,
- :author => User.current)
- a.new_record? ? (unsaved << a) : (attached << a)
- end
- if unsaved.any?
- flash[:warning] = l(:warning_attachments_not_saved, unsaved.size)
- end
- end
- attached
- end
-
# Returns the number of objects that should be displayed
# on the paginated list
def per_page_option