<commit_before>ActiveAdmin.register Invoice do


  member_action :print_invoice, :only => :show do
    @invoice = Invoice.find(params[:id])
    respond_to do |format|
      format.html
      format.pdf {
        require 'wkhtmltopdf-heroku' if Rails.env == 'production'
        render :pdf => "print_invoice",:disable_smart_shrinking => false,
               :wkhtmltopdf => 'C:\Program Files (x86)\wkhtmltopdf\wkhtmltopdf.exe',
               :template => 'admin/invoices/print_invoice.html.erb', :layout => false,
               :header => { :font_size => '8', :right => '[page] of [toPage]' },
               :footer => {:font_size => '8', :right => 'Generated by constructionsupport.co.uk' }
      }
    end
  end
  action_item :only => :show do
    link_to "Print invoice", print_invoice_admin_invoice_path(:format => :pdf)
  end
  form do |f|
    f.inputs "Customer" do
      f.input :customer
    end
    f.has_many :invoice_items do |g|
      g.input :_destroy, :as => :boolean, :label => "Remove this Product" unless g.object.nil? or g.object.id.nil?
      g.input :product_name
      g.input :value
      g.input :quantity
    end

    f.actions
  end
  show do
    attributes_table do
      row :customer
      row :created_at

    end
    panel "Products" do
      table_for invoice.invoice_items do
        column :id, :width => 100
        column :product_name
        column :value
        column :quantity
        column :created_at

      end
    end

  end
end<commit_msg>Fix on PDF for heroku<commit_after>ActiveAdmin.register Invoice do


  member_action :print_invoice, :only => :show do
    @invoice = Invoice.find(params[:id])
    respond_to do |format|
      format.html
      format.pdf {
        if Rails.env == 'production'
          require 'wkhtmltopdf-heroku'
          render :pdf => "print_invoice",:disable_smart_shrinking => false,
                 :template => 'admin/invoices/print_invoice.html.erb', :layout => false,
                 :header => { :font_size => '8', :right => '[page] of [toPage]' },
                 :footer => {:font_size => '8', :right => 'Generated by constructionsupport.co.uk' }
        else
          render :pdf => "print_invoice",:disable_smart_shrinking => false,
                 :template => 'admin/invoices/print_invoice.html.erb', :layout => false,
                 :wkhtmltopdf => 'C:\Program Files (x86)\wkhtmltopdf\wkhtmltopdf.exe',
                 :header => { :font_size => '8', :right => '[page] of [toPage]' },
                 :footer => {:font_size => '8', :right => 'Generated by constructionsupport.co.uk' }
        end
      }
    end
  end
  action_item :only => :show do
    link_to "Print invoice", print_invoice_admin_invoice_path(:format => :pdf)
  end
  form do |f|
    f.inputs "Customer" do
      f.input :customer
    end
    f.has_many :invoice_items do |g|
      g.input :_destroy, :as => :boolean, :label => "Remove this Product" unless g.object.nil? or g.object.id.nil?
      g.input :product_name
      g.input :value
      g.input :quantity
    end

    f.actions
  end
  show do
    attributes_table do
      row :customer
      row :created_at

    end
    panel "Products" do
      table_for invoice.invoice_items do
        column :id, :width => 100
        column :product_name
        column :value
        column :quantity
        column :created_at

      end
    end

  end
end
{'fraction_non_alphanumeric': 0.12093435836782969, 'fraction_numerical': 0.004730928444707274, 'mean_word_length': 2.313418217433888, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '195801', 'n_tokens_mistral': 1112, 'n_tokens_neox': 1056, 'n_words': 273}