Sha256: 7fe05a670808fc9cceb0b10ca6462a02b3b131c33b68f9bfaefaa5d4a26a1cf5

Contents?: true

Size: 533 Bytes

Versions: 3

Compression:

Stored size: 533 Bytes

Contents

module Bookkeeper
  class Purchase < ActiveRecord::Base
    mount_uploader :receipt, ReceiptUploader

    attr_accessible :description, :purchase_date, :title, :warranty_duration, :receipt, :invoice, :amount

    has_many :categories, as: :categorizable

    validates_presence_of :title
    validates_numericality_of :warranty_duration, allow_nil: true
    validates_numericality_of :amount, allow_nil: true
    validates_date :purchase_date, allow_nil: true, allow_blank: true

    default_scope order('created_at DESC')
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bookkeeper-0.0.7 app/models/bookkeeper/purchase.rb
bookkeeper-0.0.6 app/models/bookkeeper/purchase.rb
bookkeeper-0.0.5 app/models/bookkeeper/purchase.rb