Module: Invoicexpress::Models::BaseInvoice

Overview

Fields common to all invoice models, necessary for create/update

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/invoicexpress/models/invoice.rb', line 43

def self.included(base)
  base.class_eval do
    include HappyMapper
    element :id, Integer
    element :date, Date, :on_save => DATE_FORMAT
    element :due_date, Date, :on_save => DATE_FORMAT
    element :reference, String
    element :observations, String
    element :retention, Float
    element :tax_exemption, String
    element :sequence_id, Integer
    element :mb_reference, String

    element :rate, String
    element :currency_code, String

    has_one :client, Client
    has_many :items, Item, :on_save => Proc.new { |value|
      Items.new(:items => value)
    }
  end
end