getting 'wrong number of arguments (2 for 1)' when trying to access query results from SQL Server

2.2k views Asked by At

I'm using Ruby 2 and Rails 4 and trying to connect to a sql server instance using the Tiny_TDS and activerecord-sqlserver-adapter gems. It seems to connect to the database without a problem but when I try to access the returned data i get an error that says:

wrong number of arguments (2 for 1)

This is my first time trying to access sql server using Rails so I might be doing it wrong. Anyone know what I'm messing up?

My controller has this call in it:

@epeople = Eperson.where("status = ?", "A")

In my view I have the following (if i remove this from the view the page loads fine):

<% @epeople.each do |person| %>
  <%= person.firstname %><br>
<% end %>

The eperson.rb model file:

class Eperson < ActiveRecord::Base
  establish_connection(:other_db)
  self.table_name = 'EM'
end

In my database.yml I have defined "Other_db" as follows:

other_db:
  adapter: sqlserver
  mode: dblib
  database: mydatabase
  username: 'lapuser'
  password: '(omitted)'
  host: reports

My gemfile has the following:

source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails', '4.0.0'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
gem 'bootstrap-sass', '>= 3.0.0.0'
gem 'cancan'
gem 'devise'
gem 'figaro'
gem 'pg'
gem 'rolify'
gem 'simple_form'
gem 'font-awesome-sass-rails'
gem 'bootstrap-datepicker-rails'
gem 'money'
gem 'activesupport', '4.0.0'
gem 'tiny_tds'
gem 'activerecord-sqlserver-adapter', git: 'https://github.com/Desarrollo-CeSPI/activerecord-sqlserver-adapter.git'
group :development do
  gem 'better_errors'
  gem 'binding_of_caller', :platforms=>[:mri_19, :mri_20, :rbx]
  gem 'guard-bundler'
  gem 'guard-rails'
  gem 'guard-rspec'
  gem 'quiet_assets'
  gem 'rails_layout'
  gem 'rb-fchange', :require=>false
  gem 'rb-fsevent', :require=>false
  gem 'rb-inotify', :require=>false
end
group :development, :test do
  gem 'factory_girl_rails'
  gem 'rspec-rails'
end
group :production do
  gem 'unicorn'
end
group :test do
  gem 'capybara'
  gem 'database_cleaner', '1.0.1'
  gem 'email_spec'
end

Below is the output in the terminal window

    Started GET "/import/index" for 127.0.0.1 at 2013-12-23 14:46:15 -0500
    Processing by ImportController#index as HTML
    User Load (0.5ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 1 ORDER BY "users"."id" ASC LIMIT 1
    Person Load (0.3ms)  SELECT "people".* FROM "people" WHERE "people"."user_id" = $1 ORDER BY "people"."id" ASC LIMIT 1  [["user_id", 1]]
    SQL (76.7ms)  USE [elvisdatabase]
    Rendered import/index.html.erb within layouts/application (1.7ms)
    Completed 500 Internal Server Error in 1314ms

    ArgumentError - wrong number of arguments (2 for 1):
        arel (4.0.1) lib/arel/visitors/visitor.rb:22:in `visit'
      arel (4.0.1) lib/arel/visitors/visitor.rb:5:in `accept'
      activerecord (4.0.0) lib/active_record/connection_adapters/abstract/database_statements.rb:13:in `to_sql'
    activerecord (4.0.0) lib/active_record/connection_adapters/abstract/database_statements.rb:24:in `select_all'
      activerecord (4.0.0) lib/active_record/connection_adapters/abstract/query_cache.rb:63:in `select_all'
      activerecord (4.0.0) lib/active_record/querying.rb:36:in `find_by_sql'
    activerecord (4.0.0) lib/active_record/relation.rb:585:in `exec_queries'
      activerecord (4.0.0) lib/active_record/relation.rb:471:in `load'
      activerecord (4.0.0) lib/active_record/relation.rb:220:in `to_a'
    activerecord (4.0.0) lib/active_record/relation/delegation.rb:12:in `each'
      app/views/import/index.html.erb:1:in `_app_views_import_index_html_erb___2586117235874445403_70276605474900'
      actionpack (4.0.0) lib/action_view/template.rb:143:in `block in render'
    activesupport (4.0.0) lib/active_support/notifications.rb:161:in `instrument'
      actionpack (4.0.0) lib/action_view/template.rb:141:in `render'
      actionpack (4.0.0) lib/action_view/renderer/template_renderer.rb:49:in `block (2 levels) in render_template'
    actionpack (4.0.0) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
      activesupport (4.0.0) lib/active_support/notifications.rb:159:in `block in instrument'
      activesupport (4.0.0) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
    activesupport (4.0.0) lib/active_support/notifications.rb:159:in `instrument'
      actionpack (4.0.0) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
      actionpack (4.0.0) lib/action_view/renderer/template_renderer.rb:48:in `block in render_template'
    actionpack (4.0.0) lib/action_view/renderer/template_renderer.rb:56:in `render_with_layout'
      actionpack (4.0.0) lib/action_view/renderer/template_renderer.rb:47:in `render_template'
      actionpack (4.0.0) lib/action_view/renderer/template_renderer.rb:17:in `render'
    actionpack (4.0.0) lib/action_view/renderer/renderer.rb:42:in `render_template'
      actionpack (4.0.0) lib/action_view/renderer/renderer.rb:23:in `render'
      actionpack (4.0.0) lib/abstract_controller/rendering.rb:127:in `_render_template'
    actionpack (4.0.0) lib/action_controller/metal/streaming.rb:219:in `_render_template'
      actionpack (4.0.0) lib/abstract_controller/rendering.rb:120:in `render_to_body'
      actionpack (4.0.0) lib/action_controller/metal/rendering.rb:33:in `render_to_body'
    actionpack (4.0.0) lib/action_controller/metal/renderers.rb:26:in `render_to_body'
      actionpack (4.0.0) lib/abstract_controller/rendering.rb:97:in `render'
      actionpack (4.0.0) lib/action_controller/metal/rendering.rb:16:in `render'
    actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:41:in `block (2 levels) in render'
      activesupport (4.0.0) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
      /Users/taimoor/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/benchmark.rb:296:in `realtime'
    activesupport (4.0.0) lib/active_support/core_ext/benchmark.rb:12:in `ms'
      actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:41:in `block in render'
      actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime'
    activerecord (4.0.0) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
      actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:40:in `render'
      actionpack (4.0.0) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
    actionpack (4.0.0) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
      actionpack (4.0.0) lib/abstract_controller/base.rb:189:in `process_action'
      actionpack (4.0.0) lib/action_controller/metal/rendering.rb:10:in `process_action'
    actionpack (4.0.0) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
      activesupport (4.0.0) lib/active_support/callbacks.rb:433:in `_run__26590734161008152__process_action__callbacks'
      activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
    actionpack (4.0.0) lib/abstract_controller/callbacks.rb:17:in `process_action'
      actionpack (4.0.0) lib/action_controller/metal/rescue.rb:29:in `process_action'
      actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
    activesupport (4.0.0) lib/active_support/notifications.rb:159:in `block in instrument'
      activesupport (4.0.0) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
      activesupport (4.0.0) lib/active_support/notifications.rb:159:in `instrument'
    actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
      actionpack (4.0.0) lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
      activerecord (4.0.0) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
    actionpack (4.0.0) lib/abstract_controller/base.rb:136:in `process'
      actionpack (4.0.0) lib/abstract_controller/rendering.rb:44:in `process'
      actionpack (4.0.0) lib/action_controller/metal.rb:195:in `dispatch'
    actionpack (4.0.0) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
      actionpack (4.0.0) lib/action_controller/metal.rb:231:in `block in action'
      actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:80:in `dispatch'
    actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:48:in `call'
      actionpack (4.0.0) lib/action_dispatch/journey/router.rb:71:in `block in call'
      actionpack (4.0.0) lib/action_dispatch/journey/router.rb:59:in `call'
    actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:655:in `call'
      warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
      warden (1.2.3) lib/warden/manager.rb:34:in `call'
    rack (1.5.2) lib/rack/etag.rb:23:in `call'
      rack (1.5.2) lib/rack/conditionalget.rb:25:in `call'
      rack (1.5.2) lib/rack/head.rb:11:in `call'
    actionpack (4.0.0) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
      actionpack (4.0.0) lib/action_dispatch/middleware/flash.rb:241:in `call'
      rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
    rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
      actionpack (4.0.0) lib/action_dispatch/middleware/cookies.rb:486:in `call'
      activerecord (4.0.0) lib/active_record/query_cache.rb:36:in `call'
    activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
      activerecord (4.0.0) lib/active_record/migration.rb:369:in `call'
      actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
    activesupport (4.0.0) lib/active_support/callbacks.rb:373:in `_run__957366153359794441__call__callbacks'
      activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
      actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
    actionpack (4.0.0) lib/action_dispatch/middleware/reloader.rb:64:in `call'
      actionpack (4.0.0) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
      better_errors (1.1.0) lib/better_errors/middleware.rb:84:in `protected_app_call'
    better_errors (1.1.0) lib/better_errors/middleware.rb:79:in `better_errors_call'
      better_errors (1.1.0) lib/better_errors/middleware.rb:56:in `call'
      actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
    actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
      railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app'
      railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call'
    activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged'
      activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged'
      activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged'
    railties (4.0.0) lib/rails/rack/logger.rb:21:in `call'
      quiet_assets (1.0.2) lib/quiet_assets.rb:18:in `call_with_quiet_assets'
      actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
    rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
      rack (1.5.2) lib/rack/runtime.rb:17:in `call'
      activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
    rack (1.5.2) lib/rack/lock.rb:17:in `call'
      actionpack (4.0.0) lib/action_dispatch/middleware/static.rb:64:in `call'
      railties (4.0.0) lib/rails/engine.rb:511:in `call'
    railties (4.0.0) lib/rails/application.rb:97:in `call'
      rack (1.5.2) lib/rack/lock.rb:17:in `call'
      rack (1.5.2) lib/rack/content_length.rb:14:in `call'
    rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
      /Users/taimoor/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
      /Users/taimoor/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
    /Users/taimoor/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'

From log/development:

    Started GET "/import/index" for 127.0.0.1 at 2013-12-23 14:46:15 -0500
    Processing by ImportController#index as HTML
    User Load (0.5ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 1 ORDER BY "users"."id" ASC LIMIT 1
    Person Load (0.3ms)  SELECT "people".* FROM "people" WHERE "people"."user_id" = $1 ORDER BY "people"."id" ASC LIMIT 1  [["user_id", 1]]
    SQL (76.7ms)  USE [elvisdatabase]
    Rendered import/index.html.erb within layouts/application (1.7ms)
    Completed 500 Internal Server Error in 1314ms

    ArgumentError - wrong number of arguments (2 for 1):
        arel (4.0.1) lib/arel/visitors/visitor.rb:22:in `visit'
      arel (4.0.1) lib/arel/visitors/visitor.rb:5:in `accept'
      activerecord (4.0.0) lib/active_record/connection_adapters/abstract/database_statements.rb:13:in `to_sql'
    activerecord (4.0.0) lib/active_record/connection_adapters/abstract/database_statements.rb:24:in `select_all'
      activerecord (4.0.0) lib/active_record/connection_adapters/abstract/query_cache.rb:63:in `select_all'
      activerecord (4.0.0) lib/active_record/querying.rb:36:in `find_by_sql'
    activerecord (4.0.0) lib/active_record/relation.rb:585:in `exec_queries'
      activerecord (4.0.0) lib/active_record/relation.rb:471:in `load'
      activerecord (4.0.0) lib/active_record/relation.rb:220:in `to_a'
    activerecord (4.0.0) lib/active_record/relation/delegation.rb:12:in `each'
      app/views/import/index.html.erb:1:in `_app_views_import_index_html_erb___2586117235874445403_70276605474900'
      actionpack (4.0.0) lib/action_view/template.rb:143:in `block in render'
    activesupport (4.0.0) lib/active_support/notifications.rb:161:in `instrument'
      actionpack (4.0.0) lib/action_view/template.rb:141:in `render'
      actionpack (4.0.0) lib/action_view/renderer/template_renderer.rb:49:in `block (2 levels) in render_template'
    actionpack (4.0.0) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
      activesupport (4.0.0) lib/active_support/notifications.rb:159:in `block in instrument'
      activesupport (4.0.0) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
    activesupport (4.0.0) lib/active_support/notifications.rb:159:in `instrument'
      actionpack (4.0.0) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
      actionpack (4.0.0) lib/action_view/renderer/template_renderer.rb:48:in `block in render_template'
    actionpack (4.0.0) lib/action_view/renderer/template_renderer.rb:56:in `render_with_layout'
      actionpack (4.0.0) lib/action_view/renderer/template_renderer.rb:47:in `render_template'
      actionpack (4.0.0) lib/action_view/renderer/template_renderer.rb:17:in `render'
    actionpack (4.0.0) lib/action_view/renderer/renderer.rb:42:in `render_template'
      actionpack (4.0.0) lib/action_view/renderer/renderer.rb:23:in `render'
      actionpack (4.0.0) lib/abstract_controller/rendering.rb:127:in `_render_template'
    actionpack (4.0.0) lib/action_controller/metal/streaming.rb:219:in `_render_template'
      actionpack (4.0.0) lib/abstract_controller/rendering.rb:120:in `render_to_body'
      actionpack (4.0.0) lib/action_controller/metal/rendering.rb:33:in `render_to_body'
    actionpack (4.0.0) lib/action_controller/metal/renderers.rb:26:in `render_to_body'
      actionpack (4.0.0) lib/abstract_controller/rendering.rb:97:in `render'
      actionpack (4.0.0) lib/action_controller/metal/rendering.rb:16:in `render'
    actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:41:in `block (2 levels) in render'
      activesupport (4.0.0) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
      /Users/taimoor/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/benchmark.rb:296:in `realtime'
    activesupport (4.0.0) lib/active_support/core_ext/benchmark.rb:12:in `ms'
      actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:41:in `block in render'
      actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime'
    activerecord (4.0.0) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
      actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:40:in `render'
      actionpack (4.0.0) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
    actionpack (4.0.0) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
      actionpack (4.0.0) lib/abstract_controller/base.rb:189:in `process_action'
      actionpack (4.0.0) lib/action_controller/metal/rendering.rb:10:in `process_action'
    actionpack (4.0.0) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
      activesupport (4.0.0) lib/active_support/callbacks.rb:433:in `_run__26590734161008152__process_action__callbacks'
      activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
    actionpack (4.0.0) lib/abstract_controller/callbacks.rb:17:in `process_action'
      actionpack (4.0.0) lib/action_controller/metal/rescue.rb:29:in `process_action'
      actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
    activesupport (4.0.0) lib/active_support/notifications.rb:159:in `block in instrument'
      activesupport (4.0.0) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
      activesupport (4.0.0) lib/active_support/notifications.rb:159:in `instrument'
    actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
      actionpack (4.0.0) lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
      activerecord (4.0.0) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
    actionpack (4.0.0) lib/abstract_controller/base.rb:136:in `process'
      actionpack (4.0.0) lib/abstract_controller/rendering.rb:44:in `process'
      actionpack (4.0.0) lib/action_controller/metal.rb:195:in `dispatch'
    actionpack (4.0.0) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
      actionpack (4.0.0) lib/action_controller/metal.rb:231:in `block in action'
      actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:80:in `dispatch'
    actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:48:in `call'
      actionpack (4.0.0) lib/action_dispatch/journey/router.rb:71:in `block in call'
      actionpack (4.0.0) lib/action_dispatch/journey/router.rb:59:in `call'
    actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:655:in `call'
      warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
      warden (1.2.3) lib/warden/manager.rb:34:in `call'
    rack (1.5.2) lib/rack/etag.rb:23:in `call'
      rack (1.5.2) lib/rack/conditionalget.rb:25:in `call'
      rack (1.5.2) lib/rack/head.rb:11:in `call'
    actionpack (4.0.0) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
      actionpack (4.0.0) lib/action_dispatch/middleware/flash.rb:241:in `call'
      rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
    rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
      actionpack (4.0.0) lib/action_dispatch/middleware/cookies.rb:486:in `call'
      activerecord (4.0.0) lib/active_record/query_cache.rb:36:in `call'
    activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
      activerecord (4.0.0) lib/active_record/migration.rb:369:in `call'
      actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
    activesupport (4.0.0) lib/active_support/callbacks.rb:373:in `_run__957366153359794441__call__callbacks'
      activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
      actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
    actionpack (4.0.0) lib/action_dispatch/middleware/reloader.rb:64:in `call'
      actionpack (4.0.0) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
      better_errors (1.1.0) lib/better_errors/middleware.rb:84:in `protected_app_call'
    better_errors (1.1.0) lib/better_errors/middleware.rb:79:in `better_errors_call'
      better_errors (1.1.0) lib/better_errors/middleware.rb:56:in `call'
      actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
    actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
      railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app'
      railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call'
    activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged'
      activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged'
      activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged'
    railties (4.0.0) lib/rails/rack/logger.rb:21:in `call'
      quiet_assets (1.0.2) lib/quiet_assets.rb:18:in `call_with_quiet_assets'
      actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
    rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
      rack (1.5.2) lib/rack/runtime.rb:17:in `call'
      activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
    rack (1.5.2) lib/rack/lock.rb:17:in `call'
      actionpack (4.0.0) lib/action_dispatch/middleware/static.rb:64:in `call'
      railties (4.0.0) lib/rails/engine.rb:511:in `call'
    railties (4.0.0) lib/rails/application.rb:97:in `call'
      rack (1.5.2) lib/rack/lock.rb:17:in `call'
      rack (1.5.2) lib/rack/content_length.rb:14:in `call'
    rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
      /Users/taimoor/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
      /Users/taimoor/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
    /Users/taimoor/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
2

There are 2 answers

0
TaimoorQ On BEST ANSWER

To get the activerecord-sqlserver-adapter gem working I had to specify rails 4.0.0 but the Arel gem was at version 4.0.1. I changed it to 4.0.0 by adding it to my gemfile:

gem 'arel', '4.0.0'

I then ran:

bundle update arel

Restarted the rails server and now it's working

1
Anna On

Beware! The fork of activerecord-sqlserver-adapter you're using is not production-worty (the tests can't even run). The Desarrollo-CeSPI changes as more have been merged back into rails-sqlserver/activerecord-sqlserver-adapter, which is nearly ready for a 4.0 release.

The Arel visit method added and argument in Arel v4.0.1, which is why you were seeing the error. The Desarrollo-CeSPI fork is only compatible with Arel V4.0.0