Unable to do a count on named_scope

Hi all,

I’m not sure if this is a bug, but I’m having some problem doing a count, on a named_scope.

class Claim < ActiveRecord::Base

  has_many :items

  belongs_to :event

  before_save :add_pv

  accepts_nested_attributes_for :items, :allow_destroy => true

  named_scope :pending, :conditions => {:status => "Pending"}

  named_scope :approved, :conditions => {:status => "Approved"}

  named_scope :endorsed, :conditions => {:status => "Endorsed"}

end

>> @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](http://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?

Warmest regards,
David Chua