vendredi 18 août 2017

Use Foreign key in where clause in Rails

I have 2 models 1 is request and second is passed

I have a has_one association between requests and passed like this

request has_one status and status belongs_to request

in status I have a boolean field namely "passed"

Now I want to create a scope :passed -> where(request.status.passed=true) inside my requests model.

Any suggestions ?

Aucun commentaire:

Enregistrer un commentaire