sqlanywhere / activerecord-sqlanywhere-adapter

An adapter that allows ActiveRecord to communicate with SQL Anywhere
http://sqlanywhere.rubyforge.org/
Other
7 stars 25 forks source link

Rails 4.2, Arel 6.0.0 support #3

Open glennfu opened 8 years ago

glennfu commented 8 years ago

This fork here works great right now for Rails 4.1: https://github.com/jgrevzie/activerecord-sqlanywhere-adapter/tree/rails40

However in Rails 4.2, Arel 6.0.0 was introduced. With that came a whole lot of structural changes. The activerecord-fb-adapter implemented these changes by switching the Adapter based on the Arel version like so:

From: https://github.com/rowland/activerecord-fb-adapter/blob/4dd8f7c04e49ab39d0d80b5cad0a842bac0fa090/lib/active_record/connection_adapters/fb_adapter.rb

if Arel::VERSION < "6.0.0"
  require 'arel/visitors/fb'
else
  require 'arel/visitors/fb_collector'
end

The original 'arel/visitors/fb' lives here: https://github.com/rowland/activerecord-fb-adapter/blob/master/lib/arel/visitors/fb.rb The new 'arel/visitors/fb_collector' lives here: https://github.com/rowland/activerecord-fb-adapter/blob/master/lib/arel/visitors/fb_collector.rb

Tagging @jgrevzie in hopes he sees this since he did such a great job with the other updates.

Unfortunately I'm brand new to the project that uses this gem so I don't have a test suite built up to ensure I wouldn't be breaking anything if I tried the implementation myself. I'm posting this in case it inspires someone else to take a stab at it. Maybe I'll come back to this in the future once I've gotten a bit more into it!

jgrevzie commented 8 years ago

I used the test suite that comes with ActiveRecord itself. I managed to get about 95% of the tests to pass. There were some issues with timestamps, and a few remaining cases where SQL Anywhere's 'special' version of SQL caused issues. Happy to continue to help.