为什么我在 Rails 上的 Ruby 中出现此 sqli3 错误?
Why do I get this sqli3 error in Ruby on Rails?
我的 RoR 申请有问题。
它启动得很好,但是当我打开它时出现以下错误:
它说这是一个框架错误:
activerecord (5.0.7.2) lib/active_record/connection_adapters/sqlite3_adapter.rb:27:in `initialize'
activerecord (5.0.7.2) lib/active_record/connection_adapters/sqlite3_adapter.rb:27:in `new'
activerecord (5.0.7.2) lib/active_record/connection_adapters/sqlite3_adapter.rb:27:in `sqlite3_connection'
activerecord (5.0.7.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:729:in `new_connection'
activerecord (5.0.7.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:773:in `checkout_new_connection'
activerecord (5.0.7.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:752:in `try_to_checkout_new_connection'
activerecord (5.0.7.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:713:in `acquire_connection'
activerecord (5.0.7.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:490:in `checkout'
activerecord (5.0.7.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:364:in `connection'
activerecord (5.0.7.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:883:in `retrieve_connection'
activerecord (5.0.7.2) lib/active_record/connection_handling.rb:128:in `retrieve_connection'
activerecord (5.0.7.2) lib/active_record/connection_handling.rb:91:in `connection'
activerecord (5.0.7.2) lib/active_record/migration.rb:559:in `connection'
activerecord (5.0.7.2) lib/active_record/migration.rb:546:in `call'
actionpack (5.0.7.2) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
activesupport (5.0.7.2) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
activesupport (5.0.7.2) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
activesupport (5.0.7.2) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.7.2) lib/action_dispatch/middleware/callbacks.rb:36:in `call'
actionpack (5.0.7.2) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.7.2) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.0.7.2) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
web-console (3.7.0) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.7.0) lib/web_console/middleware.rb:30:in `block in call'
web-console (3.7.0) lib/web_console/middleware.rb:20:in `catch'
web-console (3.7.0) lib/web_console/middleware.rb:20:in `call'
actionpack (5.0.7.2) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.0.7.2) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.0.7.2) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.0.7.2) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.0.7.2) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.0.7.2) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.0.7.2) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.2) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.0.7.2) lib/action_dispatch/middleware/request_id.rb:24:in `call'
rack (2.2.3) lib/rack/method_override.rb:24:in `call'
rack (2.2.3) lib/rack/runtime.rb:22:in `call'
activesupport (5.0.7.2) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
actionpack (5.0.7.2) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.7.2) lib/action_dispatch/middleware/static.rb:136:in `call'
rack (2.2.3) lib/rack/sendfile.rb:110:in `call'
railties (5.0.7.2) lib/rails/engine.rb:522:in `call'
puma (3.12.6) lib/puma/configuration.rb:227:in `call'
puma (3.12.6) lib/puma/server.rb:706:in `handle_request'
puma (3.12.6) lib/puma/server.rb:476:in `process_client'
puma (3.12.6) lib/puma/server.rb:334:in `block in run'
puma (3.12.6) lib/puma/thread_pool.rb:135:in `block in spawn_thread'
我的设置:
ruby 2.6.6p146(2020-03-31 修订版 67876)[x64-mingw32]
Rails5.0.7.2
Windows10
提前感谢您的帮助!
您迁移数据库了吗?或者你可以坚持使用 MySQL 而不是 SQLite。
这是初始化 (.new) 方法的文档:
https://www.rubydoc.info/github/luislavena/sqlite3-ruby/SQLite3/Database
解决了!
问题是不是 SQL/sqlite3,而是我的 Gemfile。
无论如何,感谢大家的回复和快乐的编码! :3
我的 RoR 申请有问题。 它启动得很好,但是当我打开它时出现以下错误:
它说这是一个框架错误:
activerecord (5.0.7.2) lib/active_record/connection_adapters/sqlite3_adapter.rb:27:in `initialize'
activerecord (5.0.7.2) lib/active_record/connection_adapters/sqlite3_adapter.rb:27:in `new'
activerecord (5.0.7.2) lib/active_record/connection_adapters/sqlite3_adapter.rb:27:in `sqlite3_connection'
activerecord (5.0.7.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:729:in `new_connection'
activerecord (5.0.7.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:773:in `checkout_new_connection'
activerecord (5.0.7.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:752:in `try_to_checkout_new_connection'
activerecord (5.0.7.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:713:in `acquire_connection'
activerecord (5.0.7.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:490:in `checkout'
activerecord (5.0.7.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:364:in `connection'
activerecord (5.0.7.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:883:in `retrieve_connection'
activerecord (5.0.7.2) lib/active_record/connection_handling.rb:128:in `retrieve_connection'
activerecord (5.0.7.2) lib/active_record/connection_handling.rb:91:in `connection'
activerecord (5.0.7.2) lib/active_record/migration.rb:559:in `connection'
activerecord (5.0.7.2) lib/active_record/migration.rb:546:in `call'
actionpack (5.0.7.2) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
activesupport (5.0.7.2) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
activesupport (5.0.7.2) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
activesupport (5.0.7.2) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.7.2) lib/action_dispatch/middleware/callbacks.rb:36:in `call'
actionpack (5.0.7.2) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.7.2) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.0.7.2) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
web-console (3.7.0) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.7.0) lib/web_console/middleware.rb:30:in `block in call'
web-console (3.7.0) lib/web_console/middleware.rb:20:in `catch'
web-console (3.7.0) lib/web_console/middleware.rb:20:in `call'
actionpack (5.0.7.2) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.0.7.2) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.0.7.2) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.0.7.2) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.0.7.2) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.0.7.2) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.0.7.2) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.2) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.0.7.2) lib/action_dispatch/middleware/request_id.rb:24:in `call'
rack (2.2.3) lib/rack/method_override.rb:24:in `call'
rack (2.2.3) lib/rack/runtime.rb:22:in `call'
activesupport (5.0.7.2) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
actionpack (5.0.7.2) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.7.2) lib/action_dispatch/middleware/static.rb:136:in `call'
rack (2.2.3) lib/rack/sendfile.rb:110:in `call'
railties (5.0.7.2) lib/rails/engine.rb:522:in `call'
puma (3.12.6) lib/puma/configuration.rb:227:in `call'
puma (3.12.6) lib/puma/server.rb:706:in `handle_request'
puma (3.12.6) lib/puma/server.rb:476:in `process_client'
puma (3.12.6) lib/puma/server.rb:334:in `block in run'
puma (3.12.6) lib/puma/thread_pool.rb:135:in `block in spawn_thread'
我的设置:
ruby 2.6.6p146(2020-03-31 修订版 67876)[x64-mingw32]
Rails5.0.7.2
Windows10
提前感谢您的帮助!
您迁移数据库了吗?或者你可以坚持使用 MySQL 而不是 SQLite。
这是初始化 (.new) 方法的文档: https://www.rubydoc.info/github/luislavena/sqlite3-ruby/SQLite3/Database
解决了!
问题是不是 SQL/sqlite3,而是我的 Gemfile。
无论如何,感谢大家的回复和快乐的编码! :3