Even better!

On Apr 11, 2007, at 9:51 PM, John Parker wrote:

On 4/11/07, Javan Makhmali <[EMAIL PROTECTED]> wrote:
I'd love to do

@blurbs = Blurb.find(:all)

@about_blurb = @blurbs.give_me_the_one_where_name_is('about')

ActiveSupport adds #index_by to Enumerable which seems like it might
be useful here:

<URL:http://api.rubyonrails.org/classes/Enumerable.html#M001100>

@blurbs = Blurb.find(:all).index_by(&:name)

@blurbs would be a Hash keyed on the blurb names, allowing you to grab
@blurbs['about'], @blurbs['contact'], etc.

-John

--
John Parker
[EMAIL PROTECTED]
_______________________________________________
Sdruby mailing list
[EMAIL PROTECTED]
http://lists.sdruby.com/mailman/listinfo/sdruby

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Sdruby mailing list
[EMAIL PROTECTED]
http://lists.sdruby.com/mailman/listinfo/sdruby

Reply via email to