]> git.openstreetmap.org Git - rails.git/blob - vendor/plugins/file_column/lib/file_compat.rb
Merged 17073:17076 from trunk.
[rails.git] / vendor / plugins / file_column / lib / file_compat.rb
1 module FileColumn
2
3   # This bit of code allows you to pass regular old files to
4   # file_column.  file_column depends on a few extra methods that the
5   # CGI uploaded file class adds.  We will add the equivalent methods
6   # to file objects if necessary by extending them with this module. This
7   # avoids opening up the standard File class which might result in
8   # naming conflicts.
9
10   module FileCompat # :nodoc:
11     def original_filename
12       File.basename(path)
13     end
14     
15     def size
16       File.size(path)
17     end
18     
19     def local_path
20       path
21     end
22     
23     def content_type
24       nil
25     end
26   end
27 end
28