Guest User

Untitled

a guest
Feb 19th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. class Person < ActiveRecord::Base
  2. # needs_loan :boolean(1)
  3. has_many :loan_requests
  4.  
  5. def update_needs_loan!
  6. needs_loan = loan_requests.any? { |l| l.active? }
  7. save!
  8. end
  9. end
  10.  
  11. class LoanRequest < ActiveRecord::Base
  12. # status :string(255)
  13. def active?
  14. status == "active"
  15. end
  16. end
  17.  
  18. #
Add Comment
Please, Sign In to add comment