It seems as if there is a bug in the arel code of the adapter. Calling "Model.first" generates the following error: ActiveRecord::StatementInvalid: ActiveRecord::ConnectionAdapters::SQLAnywhereException: Syntax error near '<' on line 1: SELECT TOP #<arel::nodes::limit:0x00000102a0bbf0> "mi_def".* FROM "mi_def" You can get around it by calling "Model.first(1)", but that doesn't help when you have associations. Trying to access an associated model generates the same error. |
I fixed it myself by changing the following line in activerecord-sqlanywhere-adapter/lib/arel/visitors/sqlanywhere.rb ("TOP #{o.limit}" if o.limit), to (visit(Nodes::Top.new(o.limit.expr)) if o.limit), I will try to submit a patch when I get a chance. On second thought, maybe not. The git project is read-only. Any idea on how to submit patches?
(26 Apr '11, 00:51)
Anth
Thank you for fixing this. Please create a git patch, and email it to sqlany_interfaces@sybase.com. Thanks.
(28 Apr '11, 11:46)
Eric Farrar
|
Hi, this still appears to be broken. Why wasn't the gem updated? Is there a problem with this patch? On another note when can we expect Rails 3.1 support? |