带有Rails 5应用程序的Active-sqlserver-adapter。

时间:2016-11-02 12:34:42

标签: ruby-on-rails sql-server activerecord tiny-tds

我正在尝试使用rails 5设置一个新的应用程序。我有六个应用程序正常使用rails 4.x.

当我尝试进行捆绑安装时,出现以

开头的错误
Error:[rake --tasks] DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super. (called from <top (required)> at C:/Users/cmendla/RubymineProjects/user_message_console/config/application.rb:7)
DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super. (called from <top (required)> at C:/Users/cmendla/RubymineProjects/user_message_console/config/application.rb:7)
rake aborted!
Bundler::GemRequireError: There was an error while trying to load the gem 'activerecord-sqlserver-adapter'.
Gem Load Error is: undefined method `add_order!' for class `Class'
Backtrace for gem load error is:

如果我做捆绑显示activerecord我得到

C:\Users\cmendla\RubymineProjects\user_message_console>bundle show activerecord
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-5.0.0.1

我已尝试过普通宝石和不同版本的宝石

gem 'tiny_tds'
# gem 'activerecord-sqlserver-adapter', '~> 5.0.0'
 gem 'activerecord-sqlserver-adapter'

捆绑安装显示错误代码为0

Using activerecord-sqlserver-adapter 2.3.8
(this is a partial list ).....
Using sprockets-rails 3.2.0
Using coffee-rails 4.2.1
Using jquery-rails 4.2.1
Using web-console 3.4.0
Using rails 5.0.0.1
Using sass-rails 5.0.6
Bundle complete! 14 Gemfile dependencies, 58 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

Process finished with exit code 0

但后来我收到了上面发布的错误。我使用的服务器是server 2012

https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/rails5有一些信息,但是我加载正确的宝石版本并不清楚,因为该文件引用了gem 'activerecord-sqlserver-adapter', '~> 4.2.0'

如果有人知道rails 5和ActiveRecord SQL Server适配器之间的兼容性问题,我可以继续使用rails 4.x。否则,我想尝试让这个工作。

1 个答案:

答案 0 :(得分:2)

我最近遇到了这个问题。我通过在gemfile中添加以下内容来解决它:

gem 'activerecord-sqlserver-adapter', :github => 'rails-sqlserver/activerecord-sqlserver-adapter', :branch => 'master'