Updated Question After some further debugging I've updated this question to be more accurate on the actual problem.
I have a trait I've defined to do a basic security check but every time I want to run a DB query it throws a Cannot operate on a closed connection!!!
error.
Code below:
trait SecureAPI {
self:Controller =>
@Before
def checkKey(key:String)
models.Account.getByKey(key) match {
case account:Account => {
renderArgs += "account" -> accountId
Continue
}
case _ => Forbidden("Key is not authorized.")
}
}
The getByKey
throws the DB error. In my controllers, I'm adding Squeryl
as a trait, but how would I apply that in another trait so I can continue to run queries? Or am I just not approaching this properly? Thanks.