On Feb 23, 4:56 pm, cult hero <[email protected]> wrote:
> How do blockless filter expressions work?
>
> Do I have to enable something somewhere?
>
> The following has NEVER worked for me:
>
> Model.filter(:row > 0).first
>
> I always get: ArgumentError: comparison of Symbol with 0 failed
>
> (I'm running in Ruby 1.9 if that matters.)
>
> As such, I've always resorted to: Model.filter("row > ?", 0).first
>
> It works, but it's not ideal.
Ruby 1.9 includes Comparable in Symbol (and defines Symbol#[]), so
Sequel doesn't allow the following DSL on Ruby 1.9:
:row > 0
:sum[:column]
In 1.8, these methods are still defined for backwards compatibility,
but their use is discouraged. The virtual row support is the cleanest
way to handle a filter like that, and works on both 1.8 and 1.9:
Model.first{row > 0}
Jeremy
--
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.