@user.club.claims.pending.count
ActiveRecord::StatementInvalid: Mysql::Error: You have an error in
your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near ') AS
count_claims_all FROM claims INNER JOIN events ON ( claims.event_id
= ev’ at line 1: SELECT count(claims.) AS count_claims_all FROM claims INNER JOIN events ON ( claims.event_id = events.id ) WHERE
(((claims.status = ‘Pending’) AND (events.club_id = 1 )) AND
(events.club_id = 1 ))
I don’t really know why count isn’t working here. Can someone advice?
I’m not sure if this is a bug, but I’m having some problem doing a
count, on
a named_scope.
[…]
@user.club.claims.pending.count
ActiveRecord::StatementInvalid: Mysql::Error: You have an error in
your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near ') AS
count_claims_all FROM claims INNER JOIN events ON ( claims.event_id
= ev’ at line 1: SELECT count(claims.) AS count_claims_all FROM claims INNER JOIN events ON ( claims.event_id = events.id ) WHERE
(((claims.status = ‘Pending’) AND (events.club_id = 1 )) AND
(events.club_id = 1 ))
I don’t really know why count isn’t working here. Can someone advice?
My guess – and it is a guess – is that mySQL is complaining about
the count(claims.) construct. You can have count(table.field) or
count(), but I doubt that count(table.*) is valid. If I’m right, then
this is a bug in the SQL generation.