Frederick Cheung wrote in post #975887:
>
> foo(&:bar) is basically short hand for foo {|f| f.bar}. You'll
> probably get more google hits by searching for Sym to_proc
>
> Fred
Thanks. I indeed did have more success with 'Sym to proc'. Of course
the bar was set rather low given I found nothing the other way.
BTW I realized my original desire with a little ( actually a great deal
of ) help from the PostgreSQL list. The following works like a champ,
but only for PostgreSQL as far as I know.
> cset = Client.select("DISTINCT ON(client_category) *")
=> [ . . .
>
> cset.size
=> 6
> cset[0]
=> #<Client id: 587, dollar_value_total:
#<BigDecimal:2b1ebb23a910,'0.974E3',9(18)>, dollar_value_currency_code:
"CAD", expected_at: "2010-07-19 04:00:00", expected_to: "133",
client_category: "0492", office_code_for_unlading: " ",
service_priority: " ", service_option_identifier: "00257", . . .,
lock_version: 0>
The DISTINCT ON extension might be of some interest to those working in
PostgreSQl.
--
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.