Module: Shared::Loanable::ClassMethods

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

Instance Method Summary collapse

Instance Method Details

#loanedObject



16
17
18
# File 'app/models/concerns/shared/loanable.rb', line 16

def loaned
  joins(:loan_items)
end

#never_loanedObject



24
25
26
# File 'app/models/concerns/shared/loanable.rb', line 24

def never_loaned
  includes(:loan_items).where(loan_items: {id: nil}) 
end

#on_loanObject



20
21
22
# File 'app/models/concerns/shared/loanable.rb', line 20

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