MorningPeak/app/models/bill.rb
Arthur Poulet 2a7f23d2c5 add acts_as_commentable gem
- add acts_as_commentable to gemfile
- update gemfile.lock
- generate migration comment
- update schema
- add acts_as_commentable to client, contact, bill
2015-07-25 21:33:44 +02:00

15 lines
470 B
Ruby

class Bill < ActiveRecord::Base
acts_as_commentable
belongs_to :client
validates :due_date, presence: true
delegate :name, to: :client, prefix: true
scope :retard, -> {where("due_date <= '#{Date.today}'").where(paid: false)}
scope :advanced, -> {where("due_date > '#{Date.today}'").where(paid: true)}
scope :next, -> {where("due_date > '#{Date.today}'").where(paid: false)}
scope :old, -> {where("due_date <= '#{Date.today}'").where(paid: true)}
end