I am using 'Audit' gem in my ruby on rails application. I have used polymorphic association between Audits and my 'Orders'.Now, I want to write a named scope to get only those Audits for which Order is not nil (This is hapening because Order is being deleted after creating the Audit)
<Audit id:110,
auditable_id:4,
auditable_type:"Order",
user_id:1,
user_type:"User",
username:nil,
action:"create",
created_at:"2018-04-07 09:06:20">,
#<Audit id:49,
auditable_id:3,
auditable_type:"Order",
user_id:3,
user_type:"User",
username:nil,
action:"create",
created_at:"2018-04-06 12:28:41">,
#<Audit id:44,
auditable_id:1,
auditable_type:"Order",
user_id:3,
user_type:"User",
username:nil,
action:"create",
created_at:"2018-04-06 12:27:45">
Aucun commentaire:
Enregistrer un commentaire