On Tuesday, February 11, 2014 9:05:35 PM UTC-8, Jeremy Evans wrote:
>
> If you've already eager loaded all the values, it seems pointless to check
> with the database to get the lock version. In addition to being
> inefficient, it also creates a race condition, in that the etag created
> won't match the eagerly loaded values displayed on the page if there are
> modificaitons between the object retrieval and the etag call. I'd do
> something like this:
>
> def etag
> a = [collection]
> a << collection.map(&:items).flatten.uniq
> a << collection.map(&:resources).flatten.uniq
> a << a.last.map(&:original).uniq.compact
> a << a.last.map(&:proxies).flatten.uniq
> a.map(&:lock_version).join
>
Oops, this should be:
a.map{|x| x.map(&:lock_version)}.join
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/groups/opt_out.