@@ -2,11 +2,17 @@ class AttachmentDecorator < Draper::Decorator
   include Rails.application.routes.url_helpers
   include ActionView::Helpers::AssetTagHelper
   include ActionView::Helpers::UrlHelper
+  default_url_options[:host] = ::Rails.application.routes.default_url_options[:host]
+
   delegate_all
 
   def file_preview
     if file.content_type =~ /\Aimage/
-      image_tag(file.url, alt: "", class: "image-with-border")
+      image_tag(
+        object.url,
+        alt: "",
+        class: "image-with-border"
+      )
     else
       "<br><table class='button'><tr><td>#{link_text}</td></tr></table>"
     end
class AttachmentDecorator < Draper::Decorator
  include Rails.application.routes.url_helpers
  include ActionView::Helpers::AssetTagHelper
  include ActionView::Helpers::UrlHelper
  delegate_all

  def file_preview
    if file.content_type =~ /\Aimage/
      image_tag(file.url, alt: "", class: "image-with-border")
    else
      "<br><table class='button'><tr><td>#{link_text}</td></tr></table>"
    end
  end

  private

  def link_text
    I18n.t(
      "mailer.attachment_mailer.new_attachment_notification.attachment_cta",
      attachment_name: file.original_filename
    )
  end
end

What exactly does this do?