Module: S3Direct::Uploadable

Defined in:
lib/s3direct/uploadable.rb

Instance Method Summary collapse

Instance Method Details

#has_s3_file(attr_name, pattern, options = {}) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/s3direct/uploadable.rb', line 4

def has_s3_file(attr_name, pattern, options={})
  define_method attr_name do
    ::S3Direct::File.new(self, attr_name, pattern, options)
  end
  define_method "#{attr_name}_file=" do |filename|
    self["#{attr_name}_file"] = ::S3Direct::File.sanitize_filename(filename)
  end
end