Sha256: e2a5bbec0264c1f412ea642107b1cf39ca05fc2b184b46e2d27a6248113351df
Contents?: true
Size: 590 Bytes
Versions: 13
Compression:
Stored size: 590 Bytes
Contents
require 'liquid' class Receipt < ActiveRecord::Base belongs_to :document, :polymorphic => true serialize :fields scope :recent, where( arel_table[:created_at].gt(Date.today-1.month).or(arel_table[:printed].eq(false)) ).order(arel_table[:id].desc) def print data = fields.merge(:id => id, :keyword => Terminal.config.keyword) result = Liquid::Template.parse(template).render data.with_indifferent_access update_attributes(:printed => true) if Smartware.printer.print_text(result) end def document_title document.blank? ? '' : document.title end end
Version data entries
13 entries across 13 versions & 1 rubygems