samedi 26 décembre 2015

No such column in active record where clause

.2.0 :013 > Match.where(:approval => {summoner_id: 18})
  Match Load (0.6ms)  SELECT "matches".* FROM "matches" WHERE "approval"."summoner_id" = ?  [["summoner_id", 18]]
SQLite3::SQLException: no such column: approval.summoner_id: SELECT "matches".* FROM "matches" WHERE "approval"."summoner_id" = ?
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column: approval.summoner_id: SELECT "matches".* FROM "matches" WHERE "approval"."summoner_id" = ?

But if I do

2.2.0 :015 > Approval.first.summoner_id Approval Load (0.2ms) SELECT "approvals".* FROM "approvals" ORDER BY "approvals"."id" ASC LIMIT 1 => 18

It shows up.

I am trying to find all Matches where the Match's Approval has a specific Summoner id.

How do I search this?

Aucun commentaire:

Enregistrer un commentaire