1
- h1. DataMapper Paperclip
1
+ = DataMapper Paperclip
2
2
3
3
DM-Paperclip is a port of Thoughtbot's Paperclip plugin to work with DataMapper 0.9. This plugin is fully compatible with
4
4
the original ActiveRecord-oriented Paperclip. You could take an existing ActiveRecord database and use it with DataMapper.
@@ -14,7 +14,7 @@ It processes the thumbnails through the command-line applications instead of usi
14
14
15
15
See the documentation for the +has_attached_file+ method for options.
16
16
17
- h2. Code
17
+ == Code
18
18
19
19
The code DM-Paperclip is available at Github:
20
20
@@ -27,7 +27,7 @@ packaged as a gem through Rubyforge:
27
27
28
28
sudo gem install dm-paperclip
29
29
30
- h2. Usage
30
+ == Usage
31
31
32
32
In your model:
33
33
@@ -41,20 +41,22 @@ In your model:
41
41
:thumb => "100x100>" }
42
42
end
43
43
44
- Your database will need to add three columns, +avatar_file_name+ (varchar), +avatar_content_type+ (varchar), and
45
- +avatar_file_size+ (integer). You can either add these manually, auto-migrate, or use the following migration:
44
+ Your database will need to add four columns, avatar_file_name (varchar), avatar_content_type (varchar), and
45
+ avatar_file_size (integer), and avatar_updated_at (datetime). You can either add these manually, auto-
46
+ migrate, or use the following migration:
46
47
47
48
migration( 1, :add_user_paperclip_fields ) do
48
49
up do
49
50
modify_table :users do
50
51
add_column :avatar_file_name, "varchar(255)"
51
52
add_column :avatar_content_type, "varchar(255)"
52
53
add_column :avatar_file_size, "integer"
54
+ add_column :avatar_updated_at, "datetime"
53
55
end
54
56
end
55
57
down do
56
58
modify_table :users do
57
- drop_columns :avatar_file_name, :avatar_content_type, :avatar_file_size
59
+ drop_columns :avatar_file_name, :avatar_content_type, :avatar_file_size, :avatar_updated_at
58
60
end
59
61
end
60
62
end
0 commit comments