Count_by_sql not working

def add_state_field
user =
@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’)
@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 ?