app/models/attachment.rb
def web_viewer_type
    # Add more conditions as and when supported
    case
      when web_image? then :image
      when web_video? then :video
      when Rack::Mime.match?(mime_type, 'application/pdf') then :pdf
      when backing_store == :g_docs &&
          url.end_with?('/pub', '/pub?embedded=true')

        :g_docs_published
      else nil
    end
  end
# The browser viewer type (if any) to use for viewing this attachment.
#
# @return [Symbol, nil] the viewer type, or nil if it cannot be determined
The browser viewer type (if any) to use for viewing this attachment.
The browser viewer type ( if any ) to use for viewing this attachment .
def web_viewer_type
    case
      when web_image? then :image
      when web_video? then :video
      when Rack::Mime.match?(mime_type, 'application/pdf') then :pdf
      when backing_store == :g_docs &&
          url.end_with?('/pub', '/pub?embedded=true')
        :g_docs_published
      else nil
    end
  end
def web_viewer_type case when web_image? then :image when web_video? then :video when Rack :: Mime . match? ( mime_type , 'application/pdf' ) then :pdf when backing_store == :g_docs && url . end_with? ( '/pub' , '/pub?embedded=true' ) :g_docs_published else nil end end
The browser viewer type (if any) to use for viewing this attachment.
The browser viewer type ( if any ) to use for viewing this attachment .
# Add more conditions as and when supported
the viewer type, or nil if it cannot be determined
the viewer type or nil if it cannot be determined
Symbol, nil