In attachment_fu you can have attachment file pathes partitioned: uploaded file.jpg goes to files/0000/0167 directory, where 00000167 is internal ID of the file. With this fork you have some control over it:
Now you can specify partitioning strategy as lambda in has_attachment
statement, like this:
class Attachment < ActiveRecord::Base
has_attachment :storage => :file_system, :path_prefix => ‘files/issues’,
:partition [...]
Filed under: attachment_fu, rails
|
I’ve just made a fork of attachment_fu plugin: http://github.com/artemv/attachment_fu/tree/master.
This fork provides validation errors customization means.
Now you can pass custom error formatter method names to validates_as_attachment:
validates_as_attachment :error_formatters => {:content_type => :add_content_type_error, :size => :add_size_error}
Here’s an example of error formatter. It uses Globalize to translate the message template:
def add_content_type_error(options)
[...]
Filed under: attachment_fu, rails, ruby
|