On Jun 29, 2:48 pm, Jim Morris <[EMAIL PROTECTED]> wrote:
> Yep just discovered that empirically, may be nice to add that to the
> cheat sheet :)
>
> Also for the second issue this seems to work too...
>
> Instead of...
>
> >       ds.update do
> >         periods.each do |p| # create updates for all periods
> >           (p|idx) << (p|idx) + v
> >         end
> >       end
>
> This may work...
>
> h= periods.inject({}){ |h, p| h.merge((p|idx) => (p|idx) + v }
> ds.update_sql(h)
>
> Does that look ok?
>
> If they are all equivalent I can update.

No point in a pointless merge:

  ds.update_sql(periods.inject({}){|h, p| h[p|idx] = (p|idx) + v})

I'm not sure where the idx variable you are using is defined, though.

Jeremy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to sequel-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to