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) -- Posted via http://www.ruby-forum.com/.
Hi Maybe this: @purchaseorder.project_id.to_s On 6/1/06, scott <scott@boxuk.com> 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) > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Cheers, ioana k&a http://boulangerie.wordpress.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060601/03c23bde/attachment.html
Or: @project = Project.find(:first, :conditions => "id = #{@ purchaseorder.project_id}") On 6/1/06, scott <scott@boxuk.com> 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) > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Cheers, ioana k&a http://boulangerie.wordpress.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060601/69f96ff1/attachment.html
On 6/1/06, scott <scott@boxuk.com> 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" -- -Alder