find

Try:

User.find(:all, :conditions => [“role = ? and first LIKE A%”, params[:user][:role]] )

Just a warning, what you’ve got now has an SQL injection attack. Think about what happens if someone posts the following:

params[user[role]]=“name; DROP TABLE users; --”

What I’ve posted properly sanitizes the input so this can’t happen.

Jason

Your problem isn't too many parentheses, it is too few quotes. Try either of these:

@users = User.find(:all, :conditions => ["role = ? and first LIKE 'A%'", params[:role]] )

or

@users = User.find(:all, :conditions => ["role = ? and first LIKE ?", params[:role], 'A%'] )

-Rob

Rob Biedenharn http://agileconsultingllc.com Rob@AgileConsultingLLC.com