def index cond = params[:letter] + "%" @clients = Client.find :all, :conditions => ["firstname like ?" , cond], :order => "firstname ASC" end
This is my code and it gives me an error everytime saying this:
You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.+
How can I fix this?
What is the value of params[:letter] ? If it's nil you need to check for that...
if params[:letter].nil? # or possibly .blank? # throw a hissy fit return end