Sha256: 0ad3501e860b77315a0923d11194c10b9faa440d955f7c16e1c78c31a7001544
Contents?: true
Size: 1.42 KB
Versions: 8
Compression:
Stored size: 1.42 KB
Contents
# encoding: UTF-8 #/* - - - - - - - - - - - - - - - - - - - - - # # Title : WEB Appliances Crest Inc, Web Form Framework # Author : Enrique Phillips # URL : http://www.wac.bz # #- - - - - - - - - - - - - - - - - - - - - */ require 'print_drivers' # The <b>PrintJob</b> model holds all relevant information in regards to the PrintJob # It is possible to create a PrintJob for any other model that needs to be able to print. class OxPrintJob < AbstractResource self.table_name = 'print_jobs' establish_connection ((Rails.env=="development") ? :dev_oxen_tables : :oxen_tables ) has_paper_trail validates :name, presence: true belongs_to :printer belongs_to :account belongs_to :printed_by, polymorphic: true include Exceptions include PrintDrivers # has_paper_trail :ignore => [:state, :cups_state] scope :stated, ->(pap) { where(state: pap) } scope :queued, ->{ where(print_jobs.state >> ['processing','printing']) } scope :newest, ->{ order(created_at: :desc)} # Temporary attribute for the print_job object to hold the instanciated printer (PdfPrinter, HtmlPrinter, CsvPrinter etc.) attr_accessor :action_printer, :snap_shot, :download # # enabling background printing - via OxJob & ActiveJob & DelayedJob def perform *args context = args[0].delete(:context) if !download print_with rendered_on(args), args else send_with( rendered_on(args), context) if context end end end
Version data entries
8 entries across 8 versions & 1 rubygems