]> git.openstreetmap.org Git - rails.git/blob - vendor/plugins/file_column/README
Add an extra message to detect Postgres deadlocks.
[rails.git] / vendor / plugins / file_column / README
1 FEATURES
2 ========
3
4 Let's assume an model class named Entry, where we want to define the "image" column
5 as a "file_upload" column.
6
7 class Entry < ActiveRecord::Base
8   file_column :image
9 end
10
11 * every entry can have one uploaded file, the filename will be stored in the "image" column
12
13 * files will be stored in "public/entry/image/<entry.id>/filename.ext"
14
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.)
17
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
20
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
23   to work.
24
25 * easy integration with RMagick to resize images and/or create thumb-nails.
26
27 USAGE
28 =====
29
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
32 mechanism.
33
34 DOCUMENTATION
35 =============
36
37 Please look at the rdoc-generated documentation in the "doc" directory.
38
39 RUNNING UNITTESTS
40 =================
41
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".
46
47 You can run the tests by starting the "*_test.rb" in the directory "test"
48
49 BUGS & FEEDBACK
50 ===============
51
52 Bug reports (as well as patches) and feedback are very welcome. Please send it to
53 sebastian.kanthak@muehlheim.de
54