18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/paperclip_private/attachment.rb', line 18
def initialize(name, instance, options = {})
defaults = self.class.default_options.dup
privacy = options[:privacy]
privacy = privacy.call(instance) if privacy.respond_to?(:call)
if privacy == :private defaults[:path] = ":rails_root/:privacy#{defaults[:url]}"
defaults[:url] = "#{Rails.application.routes.url_helpers.paperclip_private_engine_path}/private/:klass/:id/:attachment_singular/:style"
end
options = defaults.deep_merge(options)
super(name, instance, options)
end
|