2017-12-22 1 views
1

Im mitten in der Durchführung einer Kante Ruby und Rails-Update für eine Web-App in Schienen 2.3.18 gebaut und läuft Rubin 1.9.3.Rails 2.3.18 upgrade auf 3.2.21 ich bekomme "keine Methode 'with_connection'" Fehler bei aktiven Datensatzabfragen

Ich habe inkrementell die Rails-Version aktualisiert und repariert Pausen und Dinge haben sich in einem stetigen Tempo vorwärts bewegt. Ich habe Rails 3.2.21 ausgeführt und habe gerade das erste Ruby-Update auf 2.0.0-p648 gemacht.

Ich kann buchstäblich nichts über diesen Fehler online finden, also hoffe ich, dass ich hier mehr Glück habe. Danke im Voraus.

Dies ist die Zeile in meinem Controller, die diesen Fehler auslöst. Beachten Sie, dass dies nicht mein Code ist. Ich aktualisiere ein 8 Jahre altes System.

@blogs = WpPosts.where(post_status: 'publish').order(post_date: :desc).limit(3) 

undefined method `with_connection' for #<ActiveRecord::ConnectionAdapters::Mysql2Adapter:0x007fc08067ae60> 

Dieser Fehler kann auf jedem aktiven Datensatz Aufruf einschließlich

WpPosts.all 

Die Datenbank Im ist mysql und im mit dem mysql2 Juwel mit Adapter, geschehen gemacht werden. Hier ist meine Edelsteindatei.

source 'http://rubygems.org' 

gem 'rails', '3.2.21' 

gem 'bigdecimal',     '1.1.0' 
gem 'business_time' 
gem 'calendar_date_select',  '2.0.0' 
gem 'gibbon',      '1.1.3' 
gem 'holidays' 
gem 'httparty',     '0.13.1' 
gem 'io-console',     '0.3' 
gem 'json',      '1.8.1' 
gem 'mini_portile',    '0.5.0' 
gem 'minitest',     '5.3.4' 
gem 'multi_json',     '1.10.1' 
gem 'multi_xml',     '0.5.5' 
gem 'journey' 

gem 'mysql2',      '~> 0.3.21' 

gem 'nokogiri',     '1.6.1' 
gem 'parseexcel',     '0.5.2' 
gem "iconv",      "~> 1.0.3" 
gem 'pdf-core',     '0.6.1' 
gem 'pdfkit',      '0.8.2' 

gem 'rubyzip',      '1.1.6' 
gem 'rufus-scheduler',    '3.0.9' 
gem 'sanitize',     '2.1.0' 
gem 'saxerator',     '0.9.4' 
# TODO address ssl_requirement error 
# gem 'ssl_requirement',    '0.1.0' 
gem 'thread_safe',     '0.3.3' 
gem 'ttfunk',      '1.4.0' 
gem 'tzinfo',      '0.3.29' 
gem 'will_paginate' 
gem 'wkhtmltopdf-binary',   '0.9.9.3' 
gem 'rails_legacy_mapper' 

group :development do 
    gem 'pry-rails' 
end 

# Needed for the new asset pipeline 
group :assets do 
    gem 'sass-rails', '~> 3.2.6' 
    # gem 'coffee-rails', '~> 3.2.2' 
    gem 'uglifier',  '>= 1.0.3' 
end 

# jQuery is the default JavaScript library in Rails 3.1 
# gem 'jquery-rails' 

In diesem Stadium bekomme ich den folgenden Fehler. Hier

undefined method `with_connection' for #<ActiveRecord::ConnectionAdapters::Mysql2Adapter:0x007fc08067ae60> 

ist der Stack-Trace

undefined method `with_connection' for #<ActiveRecord::ConnectionAdapters::Mysql2Adapter:0x007fc08067ae60> 


    arel (2.2.3) lib/arel/visitors/to_sql.rb:16:in `accept' 
arel (2.2.3) lib/arel/visitors/bind_visitor.rb:11:in `accept' 
activerecord (3.2.21) lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `to_sql' 
activerecord (3.2.21) lib/active_record/connection_adapters/abstract/database_statements.rb:18:in `select_all' 
activerecord (3.2.21) lib/active_record/connection_adapters/abstract/query_cache.rb:63:in `select_all' 
activerecord (3.2.21) lib/active_record/querying.rb:38:in `block in find_by_sql' 
activerecord (3.2.21) lib/active_record/explain.rb:41:in `logging_query_plan' 
activerecord (3.2.21) lib/active_record/querying.rb:37:in `find_by_sql' 
activerecord (3.2.21) lib/active_record/relation.rb:171:in `exec_queries' 
activerecord (3.2.21) lib/active_record/relation.rb:160:in `block in to_a' 
activerecord (3.2.21) lib/active_record/explain.rb:41:in `logging_query_plan' 
activerecord (3.2.21) lib/active_record/relation.rb:159:in `to_a' 
activerecord (3.2.21) lib/active_record/relation/finder_methods.rb:381:in `find_first' 
activerecord (3.2.21) lib/active_record/relation/finder_methods.rb:122:in `first' 
app/views/default/start.html.erb:246:in `_app_views_default_start_html_erb__1835693497152716952_70232382243240' 
actionpack (3.2.21) lib/action_view/template.rb:145:in `block in render' 
activesupport (3.2.21) lib/active_support/notifications.rb:125:in `instrument' 
actionpack (3.2.21) lib/action_view/template.rb:143:in `render' 
actionpack (3.2.21) lib/action_view/renderer/template_renderer.rb:47:in `block (2 levels) in render_template' 
actionpack (3.2.21) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument' 
activesupport (3.2.21) lib/active_support/notifications.rb:123:in `block in instrument' 
activesupport (3.2.21) lib/active_support/notifications/instrumenter.rb:20:in `instrument' 
activesupport (3.2.21) lib/active_support/notifications.rb:123:in `instrument' 
actionpack (3.2.21) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument' 
actionpack (3.2.21) lib/action_view/renderer/template_renderer.rb:46:in `block in render_template' 
actionpack (3.2.21) lib/action_view/renderer/template_renderer.rb:54:in `render_with_layout' 
actionpack (3.2.21) lib/action_view/renderer/template_renderer.rb:45:in `render_template' 
actionpack (3.2.21) lib/action_view/renderer/template_renderer.rb:18:in `render' 
actionpack (3.2.21) lib/action_view/renderer/renderer.rb:36:in `render_template' 
actionpack (3.2.21) lib/action_view/renderer/renderer.rb:17:in `render' 
actionpack (3.2.21) lib/abstract_controller/rendering.rb:110:in `_render_template' 
actionpack (3.2.21) lib/action_controller/metal/streaming.rb:225:in `_render_template' 
actionpack (3.2.21) lib/abstract_controller/rendering.rb:103:in `render_to_body' 
actionpack (3.2.21) lib/action_controller/metal/renderers.rb:28:in `render_to_body' 
actionpack (3.2.21) lib/action_controller/metal/compatibility.rb:50:in `render_to_body' 
actionpack (3.2.21) lib/abstract_controller/rendering.rb:88:in `render' 
actionpack (3.2.21) lib/action_controller/metal/rendering.rb:16:in `render' 
actionpack (3.2.21) lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render' 
activesupport (3.2.21) lib/active_support/core_ext/benchmark.rb:5:in `block in ms' 
/Users/sidylife/.rbenv/versions/2.0.0-p648/lib/ruby/2.0.0/benchmark.rb:296:in `realtime' 
activesupport (3.2.21) lib/active_support/core_ext/benchmark.rb:5:in `ms' 
actionpack (3.2.21) lib/action_controller/metal/instrumentation.rb:40:in `block in render' 
actionpack (3.2.21) lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime' 
activerecord (3.2.21) lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime' 
actionpack (3.2.21) lib/action_controller/metal/instrumentation.rb:39:in `render' 
actionpack (3.2.21) lib/action_controller/metal/implicit_render.rb:10:in `default_render' 
actionpack (3.2.21) lib/action_controller/metal/implicit_render.rb:5:in `send_action' 
actionpack (3.2.21) lib/abstract_controller/base.rb:167:in `process_action' 
actionpack (3.2.21) lib/action_controller/metal/rendering.rb:10:in `process_action' 
actionpack (3.2.21) lib/abstract_controller/callbacks.rb:18:in `block in process_action' 
activesupport (3.2.21) lib/active_support/callbacks.rb:403:in `_run__838951966072540285__process_action__2683730459786019710__callbacks' 
activesupport (3.2.21) lib/active_support/callbacks.rb:405:in `__run_callback' 
activesupport (3.2.21) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks' 
activesupport (3.2.21) lib/active_support/callbacks.rb:81:in `run_callbacks' 
actionpack (3.2.21) lib/abstract_controller/callbacks.rb:17:in `process_action' 
actionpack (3.2.21) lib/action_controller/metal/rescue.rb:29:in `process_action' 
actionpack (3.2.21) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action' 
activesupport (3.2.21) lib/active_support/notifications.rb:123:in `block in instrument' 
activesupport (3.2.21) lib/active_support/notifications/instrumenter.rb:20:in `instrument' 
activesupport (3.2.21) lib/active_support/notifications.rb:123:in `instrument' 
actionpack (3.2.21) lib/action_controller/metal/instrumentation.rb:29:in `process_action' 
actionpack (3.2.21) lib/action_controller/metal/params_wrapper.rb:207:in `process_action' 
activerecord (3.2.21) lib/active_record/railties/controller_runtime.rb:18:in `process_action' 
actionpack (3.2.21) lib/abstract_controller/base.rb:121:in `process' 
actionpack (3.2.21) lib/abstract_controller/rendering.rb:45:in `process' 
actionpack (3.2.21) lib/action_controller/metal.rb:203:in `dispatch' 
actionpack (3.2.21) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch' 
actionpack (3.2.21) lib/action_controller/metal.rb:246:in `block in action' 
actionpack (3.2.21) lib/action_dispatch/routing/route_set.rb:73:in `call' 
actionpack (3.2.21) lib/action_dispatch/routing/route_set.rb:73:in `dispatch' 
actionpack (3.2.21) lib/action_dispatch/routing/route_set.rb:36:in `call' 
journey (1.0.4) lib/journey/router.rb:68:in `block in call' 
journey (1.0.4) lib/journey/router.rb:56:in `each' 
journey (1.0.4) lib/journey/router.rb:56:in `call' 
actionpack (3.2.21) lib/action_dispatch/routing/route_set.rb:608:in `call' 
pdfkit (0.8.2) lib/pdfkit/middleware.rb:16:in `call' 
actionpack (3.2.21) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call' 
rack (1.3.10) lib/rack/etag.rb:23:in `call' 
rack (1.3.10) lib/rack/conditionalget.rb:25:in `call' 
actionpack (3.2.21) lib/action_dispatch/middleware/head.rb:14:in `call' 
actionpack (3.2.21) lib/action_dispatch/middleware/params_parser.rb:21:in `call' 
actionpack (3.2.21) lib/action_dispatch/middleware/flash.rb:242:in `call' 
rack (1.3.10) lib/rack/session/abstract/id.rb:195:in `context' 
rack (1.3.10) lib/rack/session/abstract/id.rb:190:in `call' 
actionpack (3.2.21) lib/action_dispatch/middleware/cookies.rb:341:in `call' 
activerecord (3.2.21) lib/active_record/query_cache.rb:64:in `call' 
activerecord (3.2.21) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call' 
actionpack (3.2.21) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call' 
activesupport (3.2.21) lib/active_support/callbacks.rb:405:in `_run__155349648496822945__call__1222344604970663536__callbacks' 
activesupport (3.2.21) lib/active_support/callbacks.rb:405:in `__run_callback' 
activesupport (3.2.21) lib/active_support/callbacks.rb:385:in `_run_call_callbacks' 
activesupport (3.2.21) lib/active_support/callbacks.rb:81:in `run_callbacks' 
actionpack (3.2.21) lib/action_dispatch/middleware/callbacks.rb:27:in `call' 
actionpack (3.2.21) lib/action_dispatch/middleware/reloader.rb:65:in `call' 
actionpack (3.2.21) lib/action_dispatch/middleware/remote_ip.rb:31:in `call' 
actionpack (3.2.21) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call' 
actionpack (3.2.21) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call' 
railties (3.2.21) lib/rails/rack/logger.rb:32:in `call_app' 
railties (3.2.21) lib/rails/rack/logger.rb:16:in `block in call' 
activesupport (3.2.21) lib/active_support/tagged_logging.rb:22:in `tagged' 
railties (3.2.21) lib/rails/rack/logger.rb:16:in `call' 
actionpack (3.2.21) lib/action_dispatch/middleware/request_id.rb:22:in `call' 
rack (1.3.10) lib/rack/methodoverride.rb:24:in `call' 
rack (1.3.10) lib/rack/runtime.rb:17:in `call' 
activesupport (3.2.21) lib/active_support/cache/strategy/local_cache.rb:72:in `call' 
rack (1.3.10) lib/rack/lock.rb:15:in `call' 
actionpack (3.2.21) lib/action_dispatch/middleware/static.rb:83:in `call' 
railties (3.2.21) lib/rails/engine.rb:484:in `call' 
railties (3.2.21) lib/rails/application.rb:231:in `call' 
rack (1.3.10) lib/rack/content_length.rb:14:in `call' 
railties (3.2.21) lib/rails/rack/log_tailer.rb:17:in `call' 
rack (1.3.10) lib/rack/handler/webrick.rb:59:in `service' 
/Users/sidylife/.rbenv/versions/2.0.0-p648/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service' 
/Users/sidylife/.rbenv/versions/2.0.0-p648/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run' 
/Users/sidylife/.rbenv/versions/2.0.0-p648/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread' 

Antwort

1

So konnte ich endlich nach langer Meditation herausfinden. Ich ging weiter und übersprang diese Version und nur weiter gehofft, dass es sich auflösen würde. Was irgendwie passiert ist und nicht passiert ist. Ich habe diesen Fehler beseitigt, indem ich auf die Gleise 4 vorgedrungen bin ... aber ein weiterer aktiver Datensatzfehler ist immer wieder aufgetaucht. Also schaute @tallboy auf meine gemfile und gemfile.lock, um mir zu helfen, einen Sinn für diesen neuen Fehler zu bekommen und ich erkannte an diesem Punkt, dass die Version von arel, an die meine gemfile gebunden war, eine alte 2.2.3 Version war.

Dann hatte ich eine Rückblende auf dieses Problem und erkannte, dass die ersten beiden Zeilen des Stacktrace auf diesen Fehler Aufruf der Arel-Lib waren.

Also kam ich zurück zu meinem 3.2.xx Zweig der Schienen und aktualisiert auf die richtige Arel Lib und BOOM. Es funktioniert jetzt wie ein Zauber. Schienen 3.2.22.5 ist in Betrieb und ändert nur die arel Version zu 3.0.3

Noch einmal ... @tallboy rettete meinen Hintern!

0

Sie wahrscheinlich Notwendigkeit, Ihre mysql2 gem herabzustufen, da aktuelle Version ist ein sehr jung ein.

beginnen mit

gem 'mysql2', '~> 0.3', '= 0.3.18' 

und vielleicht sogar

gem 'mysql2', '~> 0.3', '= 0.3.15' 

Ich glaube, das den Trick tun sollten.

+0

Wenn ich Ihre erste Lösung versuche, bekomme ich den gleichen Fehler nach Bundle-Installation. Wenn ich die zweite Lösung versuche, erhalte ich einen Edelstein-Ladefehler "Gem Load Fehler ist: nicht initialisierte Konstante Mysql2 :: SECURE_CONNECTION – Verty00

+0

Die Handlung verdichtet. Jetzt müssen Sie Ihr MySQL auf 5,6 (oder sogar 5.5, ich erinnere mich nicht genau zurückstufen).) – mudasobwa

+0

No Cigar:/Ich werde jetzt nur mit dem Upgrade weitermachen und hoffe, dass sich dieser Bug während des gesamten Prozesses auflöst. – Verty00

Verwandte Themen