[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Showing part of an array....

Rosina Bignall

7/22/2006 4:39:00 PM

unknown wrote:
> Rosina,
>
> I'll explain this line:
>
> colors[0..2].collect{ |color| color.name }.join(', ')
>
>

Thank you for the explanation! That helped me understand what's going on
in the collect better. Yes, name is defined. This is actually from a
rails app and colors is the table which has a name attribute (among
others), so this line works great if I want to show all the colors. In
another post a few minutes ago, I explained how I am actually using this
in a call to another function from in ajax_scaffold. I was trying to
simplify it somewhat to get at the core of the problem, but I think in
my lack of understanding, I simplified too much


Cheers,
Rosina

--
Posted via http://www.ruby-....