Open bjorntrondsen opened 12 years ago
There are problems with compatability against Rails 3.0.10 too. For intance MyModel.find(params[:id]) yields this error:
ActiveRecord::StatementInvalid (ActiveRecord::ConnectionAdapters::SQLAnywhereException: Syntax error near '<' on line 1: SELECT TOP #<Arel::Nodes::Limit:0x00000008291d70> "my_table".* FROM "my_table" WHERE (my_id = '4'))
There seem to be a general incompatibility with Arel. Statements like .first, .last and .find yields the error above.
I can confirm this problem in 3.0.10 and have an open issue on the SQLA support forum:
http://sqlanywhere-forum.sybase.com/questions/7372/errors-with-rails-3010-ruby-192
I've just been too busy to put together a small test app.
I have a fork that fixes .find, .first and .last in Rails 3.0.10. I'm looking into fixing the Rails 3.1 related issues.
Well done, I'll definitely give it a go.
Eric, are there any plans to look into this from you guys are Sybase? I have some "emergency fixes" for 3.1 on my branch, but I am not confident about putting them into production.
Did anyone ever get this working for rails 3.1?
I've not tried it yet, we are planning on moving from 3.0.7 to 3.2 in the near future so I'm hoping it will be fixed by then. Eric did say he would look at updating it to work but I've not heard anything for some time.
It's a while since I've fiddled with it, but I believe I had a "read only" version working on my rails31 branch. Inserts where broken. I wouldn't recommend anybody use that branch for anything important though, as it was just some experimental work.
For anyone who's still looking for a solution I've made a "fork" re-write based on active record 3.1.1. Everything seems to be working but it's still experimental. Let me know if you find something that isn't right. There's a compiled gem in my fork.
Source here
Awesome, I will definitely give your fork a spin in the near future and let you know if I run into any issues
For anyone still looking for a working fork for Rails 3 or Rails 4.0/4.1, from all of my tests, this works great: https://github.com/jgrevzie/activerecord-sqlanywhere-adapter/tree/rails40
Note the "rails40" branch and "rails31" and "rails32" branches.
Only thing missing now is beyond that, Arel 6.0.0 which comes with Rails 4.2 will involve some major structural changes.
Hi Eric
It doesn't look like the adapter works in Rails 3.1. When I try to fetch all records from a table through ActiveRecord, I get this error when calling "MyModel.all":
I have tested against ActiveRecord v3.0.10 and the same code runs fine there