On Fri, Apr 9, 2010 at 12:00 PM, Jeremy Evans <[email protected]>wrote:

> Building up a hash of attributes is an ActiveRecord way to approach
> the problem, but that approach is not usually needed in Sequel.
> That's not to say that I won't support the patch I attached earlier (I
> will if it doesn't harm performance too much), but I don't recommend
> the approach the patch would allow when the above works.  About the
> only time I'd recommend your approach is if the hash is being built in
> a method that has no access to the dataset it will be used on, and
> even then I'd consider it a code smell.


I encounter this situation when I have an external datastructure and I need
to convert it to a filter hash, via inject({}) {...} or similar. With the
current API, I need to create an extra branch in my code to handle the empty
case.

I consider it a code smell when an API does not have a sensible behavior for
obvious boundary conditions in its input. This is of particular concern for
functions like filter that are commonly used in situations where the
arguments are not a static condition but built dynamically from runtime
input.

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-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/sequel-talk?hl=en.

Reply via email to