summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-04-26 10:03:43 +0200
committerPeter Kozak <spag@golwen.net>2013-04-26 10:03:43 +0200
commit2c594b0f62798d077d7d55b60ca9871f9b56a07a (patch)
tree3cfbb7acb989cc35022ef033acb44f2d1ae9c90c
parent15664d01ab69da8e7478dfd45cf52ef709349428 (diff)
respond to file format
-rw-r--r--app/controllers/generic_files_controller.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/controllers/generic_files_controller.rb b/app/controllers/generic_files_controller.rb
index b7dc453..b3c0390 100644
--- a/app/controllers/generic_files_controller.rb
+++ b/app/controllers/generic_files_controller.rb
@@ -17,7 +17,15 @@ class GenericFilesController < ApplicationController
end
def show
-
+ respond_to do |format|
+ format.html
+ format.xml {render :xml => @generic_file}
+ format.all {
+ if request.format == @generic_file.file_type
+ send_file @generic_file.file.path, :type => @generic_file.file_type, :filename => "#{@generic_file.name}.#{request.parameters[:format].to_s}"
+ end
+ }
+ end
end
def new