module Paperdragon::Paperclip::Model::ClassMethods

Public Instance Methods

processable(name, attachment_class) click to toggle source
# File lib/paperdragon/paperclip/model.rb, line 10
def processable(name, attachment_class)
  # this overrides #image (or whatever the name is) from Paperclip::Model::processable.
  # This allows using both paperclip's `image.url(:thumb)` and the new paperdragon style
  # `image(:thumb).url`.
  mod = Module.new do # TODO: merge with attachment_accessor_for.
    define_method name do # e.g. Avatar#image
      Proxy.new(name, self, attachment_class)  # provide paperclip DSL.
    end
  end
  include mod
end