@results should never be nil unless he's forgotten to define the  
variable which would just be Bad Programming.
-----
Ryan Bigg
Freelancer
http://frozenplague.net







On 14/01/2009, at 9:33 AM, Maurício Linhares wrote:

>
> And instead of empty, you should use "blank?", that would work even if
> @results is "nil"
>
> x = @results.blank? ? 1 : 0
>
> -
> Maurício Linhares
> http://alinhavado.wordpress.com/ (pt-br) | http:// 
> blog.codevader.com/ (en)
>
>
>
> On Tue, Jan 13, 2009 at 6:05 PM, Pardee, Roy <[email protected]> wrote:
>>
>> x = @results.empty? ? 1 : 0
>>
>> -----Original Message-----
>> From: [email protected] 
>> [mailto:[email protected] 
>> ] On Behalf Of James Bond
>> Sent: Tuesday, January 13, 2009 11:42 AM
>> To: [email protected]
>> Subject: [Rails] Re: Number of entries
>>
>>
>> How can I write it simple?
>>
>> if @results.empty?
>> x = 0
>> else
>> x = 1
>> end
>> --
>> Posted via http://www.ruby-forum.com/.
>>
>>
>>
>>>
>>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to