title: ModelsController#index is missing a template for this request format and variant. request.formats: ["application/xlsx"] request.variant: []
body: <p>Hope you're doing well.
  I followed exactly <a href="https://www.sitepoint.com/generate-excel-spreadsheets-rails-axlsx-gem/" rel="nofollow noreferrer">this</a> Manual to create a new application and try exporting excel file using <strong>axlsx_rails</strong> Gem. This manual seems just fine and complete but when I click on line_to tag this error pops up</p>
  
  <pre><code>ProductsController#index is missing a template for this request format and variant. request.formats: ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"] request.variant: []
  </code></pre>
  
  <p>and this:</p>
  
  <pre><code>raise ActionController::UnknownFormat, message
  </code></pre>
  
  <p>I guess this error relates to my parameters or something like that.
  I'm using <strong>Rails 5</strong>
  Have any idea ?
  Thanks a million :)</p>
  
  <p><strong>Edit:</strong>
  this is my controller:</p>
  
  <pre><code>def index
       @products = Product.order('created_at DESC')
  
       respond_to do |format|
        format.html
        format.xlsx {
          response.headers['Content-Disposition'] = 'attachment; filename="all_products.xlsx"'
        }
       end
    end
  </code></pre>
  
  <p>view index.html.erb</p>
  
  <pre><code>&lt;%= link_to 'Download as .xlsx', products_path(format: :xlsx) %&gt;
  </code></pre>
  
  <p>view  index.xlsx.axlsx</p>
  
  <pre><code>  wb = xlsx_package.workbook
      wb.add_worksheet(name: "Products") do |sheet|
        @products.each do |product|
          sheet.add_row [product.title, product.price]
        end
      end
  </code></pre>