Count_by_sql not working

def add_state_field
user = current_user.id
@states = State.find(:all, :order => “name”)
@user_state_counts = Canlocation.count_by_sql(“select
count(state_id)from canlocations where” +
" user_id = ‘user’ ")
render(:partial => ‘statefield’)
end
@user_state_counts is coming up with 0 so it’s not working for some
reason ?
I believe the statement is correct but from the results it’s not -
state_id is the column I want to count so from AWDWR it shows count(*)
assuming the asterik is all , then I’ve put in state_id

Anyone ?
Stuart