Changed has_many to has_many through for user, book , through loanedbooks