On Thursday, October 17, 2013 5:34:45 AM UTC-7, Luke Ehresman wrote:
> Strike my previous email. I was getting that error because it wasn't a
> complete expression.
>
> However, now I am still seeing some strange behavior.
>
> 2.0.0p247 :027 > User.db[:users].where{id.sql_number % 2 < 1}.sql
> => "SELECT * FROM `users` WHERE ((`id` % 2) < 1)"
>
> 2.0.0p247 :028 > User.db[:users].where{id.sql_number % 2 == 1}.sql
> => "SELECT * FROM `users` WHERE 0"
>
> Why can I not compare equal to an integer?
>
Sequel doesn't override ==, as that would make it difficult to actually
test for equality. Equality expressions are done with hashes in Sequel:
User.db[:users].where{{id.sql_number % 2 => 1}}.sql
Thanks,
Jeremy
--
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.