Module: Shared::Loanable::ClassMethods

Defined in:
app/models/concerns/shared/loanable.rb

Overview

Note that these do not “dig” into potentially containing containers See instance methods for that check.

Instance Method Summary collapse

Instance Method Details

#loanedObject



22
23
24
# File 'app/models/concerns/shared/loanable.rb', line 22

def loaned
  joins(:loan_items)
end

#never_loanedObject



30
31
32
# File 'app/models/concerns/shared/loanable.rb', line 30

def never_loaned
  where.missing(:loan_items)
end

#on_loanObject



26
27
28
# File 'app/models/concerns/shared/loanable.rb', line 26

def on_loan
  joins(:loan_items).where(loan_items: { date_returned: nil })
end