Programming in Paradise

Wednesday, January 18, 2006

File Column for Rails File Uploads

There's a nifty little plugin called File Column which provides file functionality above and beyond what is built into Rails. Some of the features include the ability to store files temporarily to disk in a temp directory, long term storage of the file to disk in a customizable location, storage of the relative path in the DB, helpers for constructing the public URL for the file as well as support for getting absolute file system paths if necessary. It also integrates with ImageMagick through RMagick (although I didn't need this functionality).

There are a few deficiencies. First of all the documentation is minimal. Figuring out how to do certain things takes looking at the source code. Additionally you cannot get an IO stream directly from the ActiveRecord object. Finally, FileColumn actually adds methods to your ActiveRecord class for accessing paths and such, and that could be a problem for some people (although it wasn't in my case).

Anyhow, overall it's a good plugin and worth getting if you are doing file uploads in Rails.

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home