On 27 October 2010 11:43, Pale Horse <li...@ruby-forum.com> wrote:
> Which of the two methods below are the most stable? Does it matter?
>
> !...@articles.empty?
> @articles.length > 0
>
> I personally prefer using the 'empty?' method.

Between the two, I'd use ".empty?", but at a choice I'd use neither,
and go for ".blank?" instead.
".blank?" can be a bit more "stable" as it returns true for nil
values, as well as blank strings, empty arrays and hashes...

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to