root/vendor/plugins/file_column/README

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

added plugins

Line 
1FEATURES
2========
3
4Let's assume an model class named Entry, where we want to define the "image" column
5as a "file_upload" column.
6
7class Entry < ActiveRecord::Base
8  file_column :image
9end
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
27USAGE
28=====
29
30Just drop the whole directory into your application's "vendor/plugins" directory. Starting
31with version 1.0rc of rails, it will be automatically picked for you by rails plugin
32mechanism.
33
34DOCUMENTATION
35=============
36
37Please look at the rdoc-generated documentation in the "doc" directory.
38
39RUNNING UNITTESTS
40=================
41
42There are extensive unittests in the "test" directory. Currently, only MySQL is supported, but
43you should be able to easily fix this by looking at "connection.rb". You have to create a
44database for the tests and put the connection information into "connection.rb". The schema
45for MySQL can be found in "test/fixtures/mysql.sql".
46
47You can run the tests by starting the "*_test.rb" in the directory "test"
48
49BUGS & FEEDBACK
50===============
51
52Bug reports (as well as patches) and feedback are very welcome. Please send it to
53sebastian.kanthak@muehlheim.de
54
Note: See TracBrowser for help on using the browser.