Skip to content
Nick Sutterer edited this page Aug 27, 2014 · 1 revision

Passing Options

It is possible to pass options to the UID creation which happens in Attachment#build_uid and its sister Attachment#rebuild_uid. Generally speaking, those options are available at any point in Attachment.

model.image(file, secret: "ab34sfb3") do |v|
  v.process!#..
end

The options hash will be passed into the attachment that gets created from the model.

class Attachment < Paperdragon::Attachment
  def build_uid(style, file)
    @options[:secret] + @options[:model].id
  end
end

As you can see, @options always contains the reference to the model via :model.

Clone this wiki locally