summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-04-26 10:30:20 +0200
committerPeter Kozak <spag@golwen.net>2013-04-26 10:30:20 +0200
commit2cab3ca685d41c14c31f80bba4484531acd1cf36 (patch)
treed5551991b2a9fde23a2ad3c0a3f41b7a465fbe6f /app
parent2c594b0f62798d077d7d55b60ca9871f9b56a07a (diff)
file_extension
Diffstat (limited to 'app')
-rw-r--r--app/models/generic_file.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/generic_file.rb b/app/models/generic_file.rb
index 04c06df..24680af 100644
--- a/app/models/generic_file.rb
+++ b/app/models/generic_file.rb
@@ -42,6 +42,13 @@ class GenericFile < ActiveRecord::Base
end
end
+ def file_extension
+ mime_type = Mime::LOOKUP[self.file_type]
+ if mime_type.class == Mime::Type
+ return mime_type.symbol
+ end
+ end
+
private
def determine_file_type
if self.file_changed?