root/vendor/plugins/file_column/lib/file_compat.rb @ 6

Revision 2, 0.6 kB (checked in by falcon, 17 years ago)

added plugins

Line 
1module 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
27end
28
Note: See TracBrowser for help on using the browser.