Sha256: c73e6a503f68b2b172945a51e746b6f6cc0a27b001addccd53721a8bcf9b4ead
Contents?: true
Size: 594 Bytes
Versions: 23
Compression:
Stored size: 594 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, 15) end def document_title document.blank? ? '' : document.title end end
Version data entries
23 entries across 23 versions & 1 rubygems