Module: Transit::Extension::Attachments::ClassMethods

Defined in:
lib/transit/extensions/attachments.rb

Overview

Class level methods and functionality

Instance Method Summary collapse

Instance Method Details

#attach(name, options) ⇒ Object

Shortcut to paperclip's has_attached_file method which also defines the proper fields. Maybe one day paperclip will stop being ActiveRecord focused since it works fine with other orms hint :)



24
25
26
27
28
29
30
31
# File 'lib/transit/extensions/attachments.rb', line 24

def attach(name, options)
  has_attached_file name, options
  field :#{name.to_s}_file_name",    :type => String
  field :#{name.to_s}_content_type", :type => String
  field :#{name.to_s}_updated_at",   :type => Time
  field :#{name.to_s}_fingerprint",  :type => String
  field :#{name.to_s}_file_size",    :type => Integer
end