diff options
author | Peter Kozak <spag@golwen.net> | 2013-04-26 10:30:20 +0200 |
---|---|---|
committer | Peter Kozak <spag@golwen.net> | 2013-04-26 10:30:20 +0200 |
commit | 2cab3ca685d41c14c31f80bba4484531acd1cf36 (patch) | |
tree | d5551991b2a9fde23a2ad3c0a3f41b7a465fbe6f /app/models/generic_file.rb | |
parent | 2c594b0f62798d077d7d55b60ca9871f9b56a07a (diff) |
file_extension
Diffstat (limited to 'app/models/generic_file.rb')
-rw-r--r-- | app/models/generic_file.rb | 7 |
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? |