[Sdruby] methodphitamine
Matt Aimonetti
mattaimonetti at gmail.com
Mon Aug 20 18:28:39 GMT 2007
Something Dr Nic recently released which I think is cool might be helpful
is: map_by_method
http://drnicwilliams.com/2007/08/12/map_by_method-now-works-with-activerecord-associations/
> user.companies.map_by_id_and_name
=> [[1, 'Dr Nic Academy'], [9, 'Dr Nic Institute of Being Silly']]
Simple but handy.
-Matt
--
blog: http://railsontherun.com
On 8/20/07, Rob Kaufman <rgkaufman at gmail.com> wrote:
>
> Some code, like this particular little guy, only belong in obfuscation
> contests. Editor tools are for saving typing, not code hacks.
>
> Rob
>
> On 8/20/07, Kevin Clark <kevin.clark at gmail.com> wrote:
> >
> > I'm with Tom on this one. It's an interesting hack, but I wouldn't use
> > it for code I cared about.
> >
> > Kev
> >
> > On 8/20/07, Tom Werner <pubsub at rubyisawesome.com > wrote:
> > > I, for one, find to_proc to be just far enough over the edge of
> > > cleverness that I don't use it, and find methodphetimine so abhorrent
> > as
> > > to be an example of worst practice. Each technique saves you a few
> > > keystrokes at best and obfuscates code while decreasing performance. I
> > > fail to see a benefit to either technique (other than that they're
> > > somehow perceived as cool or flashy).
> > >
> > >
> > > Brian Chapados wrote:
> > > > http://jicksta.com/articles/2007/08/04/the-methodphitamine
> > > >
> > > > I finally finished reading through my pile-o-feeds. It's a few weeks
> > old,
> > > > but if you haven't seen it already, this one is awesome!
> > > >
> > > > spoiler:
> > > > User.find(:all).map &its.contacts.map(&its.last_name.capitalize)
> > > >
> > > >
> > >
> > > --
> > > Tom Preston-Werner
> > >
> > > * Libraries:
> > > Chronic (chronic.rubyforge.org)
> > > God (god.rubyforge.org )
> > > Fuzed (fuzed.rubyforge.org)
> > > * Site:
> > > rubyisawesome.com
> > >
> > > _______________________________________________
> > > Sdruby mailing list
> > > Sdruby at lists.sdruby.com
> > > http://lists.sdruby.com/mailman/listinfo/sdruby
> > >
> >
> >
> > --
> > Kevin Clark
> > http://glu.ttono.us
> > _______________________________________________
> > Sdruby mailing list
> > Sdruby at lists.sdruby.com
> > http://lists.sdruby.com/mailman/listinfo/sdruby
> >
>
>
> _______________________________________________
> Sdruby mailing list
> Sdruby at lists.sdruby.com
> http://lists.sdruby.com/mailman/listinfo/sdruby
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://comox.textdrive.com/pipermail/sdruby/attachments/20070820/123b6661/attachment.htm
More information about the Sdruby
mailing list