You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The documentation states that:You can specify a scope instead of a where condition string for column_names. We recommend providing a Proc that returns a hash instead of directly providing a hash: If you were to directly provide a scope this would load your schema cache on startup which will break things like rake db:migrate.
The error: /Users/Admin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/counter_culture-1.7.0/lib/counter_culture/extensions.rb:33:in `counter_culture': :column_names must be a Hash of conditions and column names (RuntimeError)
irb(main):041:0> Lead.counter_culture_fix_counts only: :promotion, where: { promotions: { id: 4162640 } }
Lead Load (0.3ms) SELECT "leads".* FROM "leads" WHERE "leads"."state" = $1 [["state", 2]]
Promotion Load (1.1ms) SELECT promotions.id, promotions.id, COUNT(leads.id)*1 AS count,
promotions.active_customers_count FROM "promotions" LEFT JOIN leads AS leads ON promotions.id =
leads.promotion_id AND (#<Lead::ActiveRecord_Relation:0x0000000113d7e740>) GROUP BY "promotions"."id" ORDER
BY "promotions"."id" ASC LIMIT $1 [["LIMIT", 1000]]
/Users/Admin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-mini-profiler-2.3.1/lib/patches/db/pg.rb:69:in `exec_params': PG::SyntaxError: ERROR: syntax error at or near ":" (ActiveRecord::StatementInvalid)
LINE 1: ...ds.promotion_id AND (#<Lead::ActiveRecord_Relation:0x0000000...
The text was updated successfully, but these errors were encountered:
At a first glance, your call to counter_culture looks correct, but it's hard to tell because I don't have the full code. Could you take a look at the specs and then open a PR with a failing spec that reproduces the error you're seeing? Otherwise this is unfortunately impossible for me to debug.
The documentation states that: You can specify a scope instead of a where condition string for column_names. We recommend providing a Proc that returns a hash instead of directly providing a hash: If you were to directly provide a scope this would load your schema cache on startup which will break things like rake db:migrate.
This is how I'm trying to define the count
The error: /Users/Admin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/counter_culture-1.7.0/lib/counter_culture/extensions.rb:33:in `counter_culture': :column_names must be a Hash of conditions and column names (RuntimeError)
If defining it like this
the above error does not occur anymore, but when trying to fix counts manually using
the query is not generated properly
The text was updated successfully, but these errors were encountered: