MorningPeak/app/models/bill.rb
2015-07-14 02:18:58 +02:00

12 lines
409 B
Ruby

class Bill < ActiveRecord::Base
belongs_to :client
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