Sometimes when building a hash of conditions on which to filter a
dataset, I end up with an empty hash:
attrs = {}
attrs[:year] = year if year
attrs[:state] = state if state
# attrs == {} if !year and !state
I'd like the dataset.filter method to accept an empty hash and yield
an unchanged dataset, so that I can simply pass in the hash and not
worry about whether it contains any conditions:
ds.filter(attrs) #=> ds
Shawn
--
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.