tag:blogger.com,1999:blog-12467669.post169351352107236823..comments2023-04-29T07:23:25.825-04:00Comments on Jay Fields' Thoughts: Rails: Array#to_sentenceJayhttp://www.blogger.com/profile/14491442812573747680noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-12467669.post-40645260728252086992008-05-24T07:28:00.000-04:002008-05-24T07:28:00.000-04:00Instead of testing, just use compact to remove nil...Instead of testing, just use compact to remove nils, or use select if you want greater control.<BR/><BR/>array.select { |element| not element.blank? }<BR/><BR/>Cheers, JayAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-12467669.post-14481034233059777242008-05-23T23:03:00.000-04:002008-05-23T23:03:00.000-04:00How do you test if the elements in the array you w...How do you test if the elements in the array you want to use .to_sentence on are not nil or empty?Carloshttps://www.blogger.com/profile/13120698915628451960noreply@blogger.comtag:blogger.com,1999:blog-12467669.post-18219012358826101382007-11-01T11:31:00.000-04:002007-11-01T11:31:00.000-04:00I use this all the time, particularly for things l...I use this all the time, particularly for things like user roles, it gives me a nice clean list like:<BR/>User: Jared. Roles: admin, editor and contributor.Anonymousnoreply@blogger.com