Guest User

Untitled

a guest
Jun 18th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. class FinancingPeriod < ActiveRecord::Base
  2. extend ActiveSupport::Memoizable
  3.  
  4. belongs_to :event
  5.  
  6. has_many :financings, :dependent => :destroy
  7.  
  8. named_scope :current, lambda { |year| {:order => :date, :conditions => ['YEAR(date) = ?', year || Time.now.year.to_int] } }
  9.  
  10. def planned_federal_financing
  11. financings.sum(&:planned_federal_financing)
  12. end
  13.  
  14. memoize :planned_federal_financing
  15. end
Add Comment
Please, Sign In to add comment