From: Jason Palmer Date: 2007-02-25T11:51:57+09:00 Subject: Re: Testing a query result ------=_Part_70410_26063274.1172371915168 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline The easiest way to do this is using the exists? function. Example: if Book.exists?(params[:id]) @BookDetails = Book.find(params[:id]) else #No results end On 2/24/07, Mahmou M'hiri wrote: > > Hello every body, > > It's a very basic question, i want just to test if this query did return > any result. > > @BookDetails = Book.find(params[:id]) > > > I tried "nil", but it seems that even if there isn't any book with that > id, @BookDetails is != nil. > > Help please! > > -- > Posted via http://www.ruby-forum.com/. > > ------=_Part_70410_26063274.1172371915168--