Open pabuisson opened 3 years ago
Hey,
I just noticed the in-memory setting for the DB : https://github.com/ngs/middleman-blog-similar#database-location I tried it and... it crashed. Here's what I've been doing:
middleman-blog-similar
config.rb
activate :similar, db: ':memory:'
current_article.similar_articles
middleman serve
middleman build
Here's the error I'm getting :
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: articles: SELECT "articles".* FROM "articles" WHERE "articles"."page_id" = ? LIMIT ? HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sqlite3-1.4.2/lib/sqlite3/database.rb:147:in `initialize' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sqlite3-1.4.2/lib/sqlite3/database.rb:147:in `new' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sqlite3-1.4.2/lib/sqlite3/database.rb:147:in `prepare' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-5.2.4.4/lib/active_record/connection_adapters/sqlite3_adapter.rb:228:in `block (2 levels) in exec_query' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.4.4/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-5.2.4.4/lib/active_record/connection_adapters/sqlite3_adapter.rb:213:in `block in exec_query' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-5.2.4.4/lib/active_record/connection_adapters/abstract_adapter.rb:581:in `block (2 levels) in log' HOME/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-5.2.4.4/lib/active_record/connection_adapters/abstract_adapter.rb:580:in `block in log' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.4.4/lib/active_support/notifications/instrumenter.rb:23:in `instrument' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-5.2.4.4/lib/active_record/connection_adapters/abstract_adapter.rb:571:in `log' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-5.2.4.4/lib/active_record/connection_adapters/sqlite3_adapter.rb:212:in `exec_query' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-5.2.4.4/lib/active_record/connection_adapters/abstract/database_statements.rb:482:in `select_prepared' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-5.2.4.4/lib/active_record/connection_adapters/abstract/database_statements.rb:68:in `select_all' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-5.2.4.4/lib/active_record/connection_adapters/abstract/query_cache.rb:106:in `select_all' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-5.2.4.4/lib/active_record/querying.rb:41:in `find_by_sql' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-5.2.4.4/lib/active_record/statement_cache.rb:108:in `execute' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-5.2.4.4/lib/active_record/core.rb:208:in `find_by' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/middleman-blog-similar-2.0.1/lib/middleman-blog-similar/database.rb:63:in `find_similar' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/middleman-blog-similar-2.0.1/lib/middleman-blog-similar/blog_article_extensions.rb:6:in `similar_articles' layouts/post.erb:21:in `__tilt_70157147094300' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/tilt-2.0.10/lib/tilt/template.rb:170:in `call' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/tilt-2.0.10/lib/tilt/template.rb:170:in `evaluate' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/tilt-2.0.10/lib/tilt/template.rb:109:in `render' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/middleman-core-4.3.11/lib/middleman-core/file_renderer.rb:79:in `render' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/middleman-core-4.3.11/lib/middleman-core/template_renderer.rb:157:in `block in render' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.4.4/lib/active_support/notifications.rb:170:in `instrument' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/middleman-core-4.3.11/lib/middleman-core/util.rb:21:in `instrument' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/middleman-core-4.3.11/lib/middleman-core/template_renderer.rb:156:in `render' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/middleman-core-4.3.11/lib/middleman-core/sitemap/resource.rb:154:in `render' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/middleman-blog-4.0.3/lib/middleman-blog/blog_article.rb:59:in `render' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/middleman-core-4.3.11/lib/middleman-core/rack.rb:113:in `process_request' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/middleman-core-4.3.11/lib/middleman-core/rack.rb:67:in `block in call' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/middleman-core-4.3.11/lib/middleman-core/rack.rb:66:in `catch' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/middleman-core-4.3.11/lib/middleman-core/rack.rb:66:in `call' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/urlmap.rb:74:in `block in call' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/urlmap.rb:58:in `each' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/urlmap.rb:58:in `call' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/show_exceptions.rb:23:in `call' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/head.rb:12:in `call' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/lint.rb:50:in `_call' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/lint.rb:38:in `call' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/builder.rb:244:in `call' HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/handler/webrick.rb:95:in `service' HOME/.rbenv/versions/2.6.3/lib/ruby/2.6.0/webrick/httpserver.rb:140:in `service' HOME/.rbenv/versions/2.6.3/lib/ruby/2.6.0/webrick/httpserver.rb:96:in `run' HOME/.rbenv/versions/2.6.3/lib/ruby/2.6.0/webrick/server.rb:307:in `block in start_thread'
And here's my Gemfile.lock, in case it can help
Gemfile.lock
GEM remote: https://rubygems.org/ specs: activemodel (5.2.4.4) activesupport (= 5.2.4.4) activerecord (5.2.4.4) activemodel (= 5.2.4.4) activesupport (= 5.2.4.4) arel (>= 9.0) activesupport (5.2.4.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) arel (9.0.0) backports (3.20.0) builder (3.2.4) coffee-script (2.4.1) coffee-script-source execjs coffee-script-source (1.12.2) concurrent-ruby (1.1.7) contracts (0.13.0) dotenv (2.7.6) erubis (2.7.0) execjs (2.7.0) fast_blank (1.0.0) fastimage (2.2.1) ffi (1.14.2) haml (5.2.1) temple (>= 0.8.0) tilt hamster (3.0.0) concurrent-ruby (~> 1.0) hashie (3.6.0) i18n (0.9.5) concurrent-ruby (~> 1.0) kramdown (2.3.0) rexml listen (3.0.8) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) memoist (0.16.2) middleman (4.3.11) coffee-script (~> 2.2) haml (>= 4.0.5) kramdown (>= 2.3.0) middleman-cli (= 4.3.11) middleman-core (= 4.3.11) middleman-blog (4.0.3) addressable (~> 2.3) middleman-core (>= 4.0.0) tzinfo (>= 0.3.0) middleman-blog-similar (2.0.1) activerecord (~> 5.0, >= 5.0.0) middleman-blog (~> 4.0, >= 4.0.0) middleman-core (~> 4.0, >= 4.0.0) sqlite3 (~> 1.3) middleman-cli (4.3.11) thor (>= 0.17.0, < 2.0) middleman-core (4.3.11) activesupport (>= 4.2, < 6.0) addressable (~> 2.3) backports (~> 3.6) bundler contracts (~> 0.13.0) dotenv erubis execjs (~> 2.0) fast_blank fastimage (~> 2.0) hamster (~> 3.0) hashie (~> 3.4) i18n (~> 0.9.0) listen (~> 3.0.0) memoist (~> 0.14) padrino-helpers (~> 0.13.0) parallel rack (>= 1.4.5, < 3) sassc (~> 2.0) servolux tilt (~> 2.0.9) uglifier (~> 3.0) minitest (5.14.2) padrino-helpers (0.13.3.4) i18n (~> 0.6, >= 0.6.7) padrino-support (= 0.13.3.4) tilt (>= 1.4.1, < 3) padrino-support (0.13.3.4) activesupport (>= 3.1) parallel (1.20.1) public_suffix (4.0.6) rack (2.2.3) rb-fsevent (0.10.4) rb-inotify (0.10.1) ffi (~> 1.0) redcarpet (3.5.1) rexml (3.2.4) sassc (2.4.0) ffi (~> 1.9) servolux (0.13.0) sqlite3 (1.4.2) temple (0.8.2) thor (1.0.1) thread_safe (0.3.6) tilt (2.0.10) tzinfo (1.2.9) thread_safe (~> 0.1) uglifier (3.2.0) execjs (>= 0.3.0, < 3) PLATFORMS ruby DEPENDENCIES builder (~> 3.0) middleman (~> 4.2) middleman-blog middleman-blog-similar redcarpet (~> 3.3, >= 3.3.3) BUNDLED WITH 2.0.1
Anything I'm missing? Should this work, and is a fix (maybe) needed somewhere? I can't believe I'm the only one encountering this issue.
If that can help, I've created a repo to reproduce the issue: https://bitbucket.org/pabuisson/blog-similar-sqlite3-error
Hey,
I just noticed the in-memory setting for the DB : https://github.com/ngs/middleman-blog-similar#database-location I tried it and... it crashed. Here's what I've been doing:
middleman-blog-similar
dependencyconfig.rb
, add theactivate :similar, db: ':memory:'
linecurrent_article.similar_articles
middleman serve
and reach a page, or callmiddleman build
Here's the error I'm getting :
And here's my
Gemfile.lock
, in case it can helpAnything I'm missing? Should this work, and is a fix (maybe) needed somewhere? I can't believe I'm the only one encountering this issue.