Closed mhuggins closed 9 years ago
Ahh, I (partially) figured it out. I have a variable in the same context named account_id
. Should I be using my{account_id}
for the query instead?
User.where{my{account_id} != nil}.count
Alright, I got it. Looks like I can pass a param to reference:
User.where{ |u| u.account_id != nil}.count
I'm trying to write a query based upon an
account_id
column on a model. (Note that this is not an ID utilized for abelongs_to
relationship; it is simply a custom generated string that is meant to tell users "this is your account number".) Unfortunately, this one column is being ignored by squeel as seen below.I included the
mongo_id
example above to show another similar column that is also a custom value, not intended for a join. In that example, the query produced matches expectations.For reference, here's my table definition:
Additionally, here's some manual testing in Rails console to ensure the attribute is properly defined on the ActiveModel class:
Any help is appreciated!