2a7f23d2c5
- add acts_as_commentable to gemfile - update gemfile.lock - generate migration comment - update schema - add acts_as_commentable to client, contact, bill
15 lines
470 B
Ruby
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
|