Guest User

Untitled

a guest
Jun 18th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. class Event < ActiveRecord::Base
  2. extend ActiveSupport::Memoizable
  3.  
  4. cattr_accessor :year
  5.  
  6. belongs_to :program
  7. has_many :financing_periods, :dependent => :destroy
  8.  
  9. def current_period
  10. financing_periods.current(@@year).last(:include => [:plain_financings, { :named_financings => :district }])
  11. end
  12.  
  13. def planned_federal_financing
  14. current_period ? current_period.planned_federal_financing : 0.0
  15. end
  16.  
  17. memoize :current_period,
  18. :planned_federal_financing
  19. end
Add Comment
Please, Sign In to add comment