4 Let's assume an model class named Entry, where we want to define the "image" column
5 as a "file_upload" column.
7 class Entry < ActiveRecord::Base
11 * every entry can have one uploaded file, the filename will be stored in the "image" column
13 * files will be stored in "public/entry/image/<entry.id>/filename.ext"
15 * Newly uploaded files will be stored in "public/entry/tmp/<random>/filename.ext" so that
16 they can be reused in form redisplays (due to validation etc.)
18 * in a view, "<%= file_column_field 'entry', 'image' %> will create a file upload field as well
19 as a hidden field to recover files uploaded before in a case of a form redisplay
21 * in a view, "<%= url_for_file_column 'entry', 'image' %> will create an URL to access the
22 uploaded file. Note that you need an Entry object in the instance variable @entry for this
25 * easy integration with RMagick to resize images and/or create thumb-nails.
30 Just drop the whole directory into your application's "vendor/plugins" directory. Starting
31 with version 1.0rc of rails, it will be automatically picked for you by rails plugin
37 Please look at the rdoc-generated documentation in the "doc" directory.
42 There are extensive unittests in the "test" directory. Currently, only MySQL is supported, but
43 you should be able to easily fix this by looking at "connection.rb". You have to create a
44 database for the tests and put the connection information into "connection.rb". The schema
45 for MySQL can be found in "test/fixtures/mysql.sql".
47 You can run the tests by starting the "*_test.rb" in the directory "test"
52 Bug reports (as well as patches) and feedback are very welcome. Please send it to
53 sebastian.kanthak@muehlheim.de