activerecord-hackery / squeel

Active Record, improved. Live again :)
http://erniemiller.org/2013/11/17/anyone-interested-in-activerecord-hackery/
MIT License
2.4k stars 213 forks source link

Support for PostgreSQL arrays #413

Open rapides opened 8 years ago

rapides commented 8 years ago

I'm looking for something like this:

Pitch.joins{pitch_permission}.where{pitch_permission.invest_permissions.op('@>', 'ARRAY[5]::int[]')}

but it currently doesn't work this way:

Pitch Load (1.1ms) SELECT "pitches".* FROM "pitches" INNER JOIN "pitch_permissions" ON "pitch_permissions"."pitch_id" = "pitches"."id" WHERE "pitch_permissions"."invest_permissions" @> 'ARRAY[5]::int[]' PG::InvalidTextRepresentation: ERROR: malformed array literal: "ARRAY[5]::int[]" LINE 1: ...WHERE "pitch_permissions"."invest_permissions" @> 'ARRAY[5]:...

Is here any another way to do that using squeel or could you provide support somehow?