Method: Paperclip::Attachment#initialize
- Defined in:
- lib/paperclip/attachment.rb
#initialize(name, instance, options = {}) ⇒ Attachment
Creates an Attachment object. name
is the name of the attachment, instance
is the ActiveRecord object instance it’s attached to, and options
is the same as the hash passed to has_attached_file
.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/paperclip/attachment.rb', line 29 def initialize name, instance, = {} @name = name @instance = instance = self.class..merge() @url = [:url] @url = @url.call(self) if @url.is_a?(Proc) @path = [:path] @path = @path.call(self) if @path.is_a?(Proc) @styles = [:styles] @normalized_styles = nil @default_url = [:default_url] @default_style = [:default_style] @storage = [:storage] @use_timestamp = [:use_timestamp] @whiny = [:whiny_thumbnails] || [:whiny] @convert_options = [:convert_options] @processors = [:processors] @options = @queued_for_delete = [] @queued_for_write = {} @errors = {} @dirty = false initialize_storage end |