December 2007 - Posts

  • A Study in Array#Collect
    Stephen Chu talked about how to beautify statements like customers.collect { |customer| customer.name } in one of his posts . Dr. Nic also has a post talking about the same thing. It's very interesting to see so many people want to get away the cumbersome collect syntax and I am one of these people. To beautify the collect syntax when we need just one field such as customer.name . There are several ways:to use Stephen's syntax: customers.collect_name Dr. Nic's : customers.names And guess what, if you are using Rails, it comes with a Symbol extension...
    read more
  • Permalink: Tuesday, December 04, 2007 11:14 AM
    Posted by ywen | 0 Comments
    Filed under