Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Active Record 4.0.0 not supported #250

cleblanc87 opened this Issue Jan 18, 2013 · 14 comments


None yet
6 participants

Bundler could not find compatible versions for gem "activerecord":
In Gemfile:
activerecord-sqlserver-adapter (>= 0) ruby depends on
activerecord (~> 3.2.0) ruby

rails (>= 0) ruby depends on
  activerecord (4.0.0.beta)

metaskills commented Jan 18, 2013

Yup, no work has been done for ActiveRecord 4.0 yet.

I have it working, and a pull request ready, but I have been unable to get the unit tests to run, was just about to go to the google group and ask this but

/Users/Christopher/websites/mygit/activerecord-sqlserver-adapter/test/cases/aaaa_create_tables_test_sqlserver.rb:8:in '<class:AAAACreateTablesTestSqlserver>': undefined method 'should' for AAAACreateTablesTestSqlserver:Class (NoMethodError)

Should I pursue the testing or open a request for the with my 4.0.0-dev branch?


metaskills commented Jan 18, 2013

The first step to upgrading anything is to get the tests running. Nothing else should happen before it. In that spirit, this project needs to update and move away from should. This is fairly easy to do too. We can use minitest-spec-rails and change all setup/teardown to before/after and all context/should blocks to describe/it.


metaskills commented Mar 28, 2013

Note about new database tasks. rails/rails#9971 (comment)


metaskills commented Jul 4, 2013

Please read this thread on the Google Group about being a contributor too.


metaskills commented Jul 7, 2013

Just published this info on the group.

  1. I have just caught up on several outstanding issues with TinyTDS and published a 0.6.0 release. Thanks to everyone who helped out, especially to @lepfhty for the thread safe work!

  2. Merged in @raydog153's 3-2-stable work. Also, I have added you as a collaborator. Let's stick to branch work and reviews for awhile please.

  3. Drop shoulda and use minitest-spec-rails!!! Yup! About damn time! This should drastically reduce the complexities of upgrading to Rails 4.0.

  4. Other misc fixes like SQL Azure, Using CONCAT_NULL_YIELDS_NULL for all TinyTDS connections, etc. Closed out all pull requests and a handful of issues.

  5. Published v3.2.11 with all the work and created a 3-2-stable branch. Now master can be for active Rails 4.0 development.

FYI activerecord-sqlserver-adapter (master, with the activerecord requirement removed from the gemspec) seems to work with Rails 4, at least as far as doing SELECTs are concerned... which is all we use it for. So that's great! 🌟 🎆

There is a deprecation warning though.

[3] pry(main)> ContentModel::Document.find(100)
  ContentModel::Document Load (53.3ms)  EXEC sp_executesql N'SELECT TOP (1) [dbo].[DOCUMENT].* FROM [dbo].[DOCUMENT] WHERE [dbo].[DOCUMENT].[document_id] = @0', N'@0 int', @0 = 100  [["document_id", 100]]
DEPRECATION WARNING: the object returned from `select_all` must respond to `column_types`. (called from __pry__ at (pry):3)
=> #<ContentModel::Document document_id: 100, document_type_id: 9, latest_version_id: 481, published_version_id: 481, legacy_document_id: 3>

While we have not done any work towards testing, my team and I have made several fixes for rails4, some other performance improvements, and added features on our fork https://github.com/arthrex/activerecord-sqlserver-adapter. Now that shoulda etc has been removed, if our changes are rebased onto the master here, test should be runnable.

We do not currently have immediate plans to work on the test suite, as we are nearing a large milestone in a couple weeks, but with some help we could get our fork ready to get merged back into master.

@cleblanc87 I am getting an error when I try to use this fork in my Gemfile: 'database configuration does not specify adapter'. I also tried to use your '4.0.0-dev2' branch, same error. Have you run across this? I am trying to perform a legacy migration from MS SQL.


   adapter: sqlserver
   mode: odbc
   host: db_host_ip
   database: legacy_db_name
   port: 1433
   username: username
   password: password

@drewsheneman You can try connecting to your DB like so, this works for us on that branch on Rails 4:

class LegacyTable < ActiveRecord::Base
    :adapter     => "sqlserver",
    :host          => "host",
    :username => "user",
    :password => "pass",
    :database => "dbname"

Worked like a charm. I wish I could give you an upvote :-)

Thanks @speedmanly . Works well 👍

I managed to get the tests running somewhat. I needed to comment out two manual requires of activesupport/core_ext/exception and activerecord/session_store. These were raising large exceptions before anything could run.

Commented out those two lines and the tests "ran". However not many and there were a few errors. Then it core dumped. I think I'm kind of out of my depth when it starts getting into that area...

https://github.com/brocktimus/activerecord-sqlserver-adapter/tree/using_pull is the branch I was using. This was master and then I did a git pull of https://github.com/arthrex/activerecord-sqlserver-adapter.


metaskills commented Jan 17, 2014

Master has current 4.0 work. Closing all tickets till a release.

@metaskills metaskills closed this Jan 17, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment