Can't convert Fixnum into String?

I have been getting this error message on various pages, just wondering
if anyone could explain whats going wrong, and the best way to correct
it

code that is cuasing the problem is below
@project = Project.find(:first, :conditions => "id = " +
@purchaseorder.project_id)

Hi
Maybe this: @purchaseorder.project_id.to_s

Or: @project = Project.find(:first, :conditions => “id = #{@
purchaseorder.project_id}”)

On 6/1/06, scott [email protected] wrote:

I have been getting this error message on various pages, just wondering
if anyone could explain whats going wrong, and the best way to correct
it

code that is cuasing the problem is below
@project = Project.find(:first, :conditions => "id = " +
@purchaseorder.project_id)

The problem is your attempt to add a number to a string. When adding
foo + bar, if foo is a string, bar should be a string too. The
simplest solution would be to convert @purchaseorder.project_id to a
string with @purchaseorder.project_id.to_s.

A better solution imho would be to embed @purchaseorder.project_id in
a string, like this:

… :conditions => “id = #@purchaseorder.project_id

thanks, kind of makes sense now!