activerecord-hackery / meta_where

ActiveRecord 3 query syntax on steroids. Not currently maintained.

Home Page:http://erniemiller.org/2013/11/17/anyone-interested-in-activerecord-hackery/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MetaWhere::Column instead of column name

amcox opened this issue · comments

I'm getting the following error:

ActiveRecord::StatementInvalid PGError: ERROR: column observations.#<MetaWhere::Column:0x0000010347dcf0> does not exist

The full SQL query it's attempting is:

 SELECT "observations".* FROM "observations" WHERE (("observations"."district_id" = 1) OR (("observations"."#<MetaWhere::Column:0x0000010347dcf0>" IN (4, 1)) OR (("observations"."teacher_id" = 12) OR ("observations"."observer_id" = 12))))

I'm using MetaWhere through CanCan, so I'm not sure where the issue is located, but the line of ruby producing the issue is in the Ability class for CanCan:

can :read, Observation, :school_id.in => user.schools_over_ids

If I comment that out, no error.

I'm happy to take the issue over to CanCan if needed, but figured I'd start here. Any insights into further diagnosis would be awesome.

Digging more into the CanCan issues, it looks like it's probably over there.

My bad, cancan issue that's being worked on. Closing.

Looking forward to playing around with Squeel and Ransack soon, too.

Much thanks.