Ruby Object Mapper commands not recognized

40 Views Asked by At

I am learning Sinatra and Rom. I forked the dusty sinatra-rom project on GitHub.

I run the program with bundle exec rackup.

This issue has me stumped:

db/commands/products/create.rb throws undefined method relation for CreateProduct:Class (NoMethodError) relation :products

Here is the start of that file:

class CreateProduct < ROM::SQL::Commands::Create[:sql]
  relation :products
  register_as :create
...

Both the relation and the register_as commands are not recognized.

This is the Gemfile:

Gemfile
source "https://rubygems.org"

gem 'bundler'
gem 'sinatra'
gem 'rom', github: 'rom-rb/rom'
gem 'rom-sql', github: 'rom-rb/rom-sql'
gem 'virtus'
gem 'lotus-validations'
# gem 'puma'
gem 'dotenv'
gem 'multi_json'
gem 'oj'
gem 'activesupport'
gem 'bcrypt'

group :development, :test do
  gem 'sqlite3'
end

group :test do
  gem 'rspec'
  gem 'rack-test'
  gem 'database_cleaner'
end

Gemfile.lock is:

GIT
  remote: https://github.com/rom-rb/rom-sql.git
  revision: 596fea491ace84ae1aea12599879f84cb0ce5b64
  specs:
    rom-sql (4.0.0.alpha1)
      dry-core (~> 1.0)
      dry-types (~> 1.7)
      rom (~> 6.0.0.alpha)
      sequel (>= 5)

GIT
  remote: https://github.com/rom-rb/rom.git
  revision: 7fb82cf7ffa86805d9c5499a4ecc64d5d3c20f14
  specs:
    rom (6.0.0.alpha1)
      concurrent-ruby (~> 1.1)
      dry-core (>= 1.0.0.rc1, < 2)
      dry-effects (~> 0.4)
      dry-inflector (>= 1.0.0.rc1, < 2)
      dry-initializer (~> 3.1)
      dry-struct (~> 1.4)
      dry-transformer (~> 1.0)
      dry-types (~> 1.5)
      zeitwerk (~> 2.6)

GEM
  remote: https://rubygems.org/
  specs:
    activemodel (7.0.4.2)
      activesupport (= 7.0.4.2)
    activerecord (7.0.4.2)
      activemodel (= 7.0.4.2)
      activesupport (= 7.0.4.2)
    activesupport (7.0.4.2)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (>= 1.6, < 2)
      minitest (>= 5.1)
      tzinfo (~> 2.0)
    axiom-types (0.1.1)
      descendants_tracker (~> 0.0.4)
      ice_nine (~> 0.11.0)
      thread_safe (~> 0.3, >= 0.3.1)
    bcrypt (3.1.18)
    coercible (1.0.0)
      descendants_tracker (~> 0.0.1)
    concurrent-ruby (1.2.0)
    database_cleaner (2.0.1)
      database_cleaner-active_record (~> 2.0.0)
    database_cleaner-active_record (2.0.1)
      activerecord (>= 5.a)
      database_cleaner-core (~> 2.0.0)
    database_cleaner-core (2.0.1)
    descendants_tracker (0.0.4)
      thread_safe (~> 0.3, >= 0.3.1)
    diff-lcs (1.5.0)
    dotenv (2.8.1)
    dry-core (1.0.0)
      concurrent-ruby (~> 1.0)
      zeitwerk (~> 2.6)
    dry-effects (0.4.0)
      concurrent-ruby (~> 1.0)
      dry-core (~> 1.0)
      dry-inflector (~> 1.0)
      dry-initializer (~> 3.0)
      zeitwerk (~> 2.6)
    dry-inflector (1.0.0)
    dry-initializer (3.1.1)
    dry-logic (1.5.0)
      concurrent-ruby (~> 1.0)
      dry-core (~> 1.0, < 2)
      zeitwerk (~> 2.6)
    dry-struct (1.6.0)
      dry-core (~> 1.0, < 2)
      dry-types (>= 1.7, < 2)
      ice_nine (~> 0.11)
      zeitwerk (~> 2.6)
    dry-transformer (1.0.1)
      zeitwerk (~> 2.6)
    dry-types (1.7.0)
      concurrent-ruby (~> 1.0)
      dry-core (~> 1.0, < 2)
      dry-inflector (~> 1.0, < 2)
      dry-logic (>= 1.4, < 2)
      zeitwerk (~> 2.6)
    i18n (1.12.0)
      concurrent-ruby (~> 1.0)
    ice_nine (0.11.2)
    lotus-utils (0.6.1)
    lotus-validations (0.4.0)
      lotus-utils (~> 0.6)
    minitest (5.17.0)
    multi_json (1.15.0)
    mustermann (3.0.0)
      ruby2_keywords (~> 0.0.1)
    oj (3.13.23)
    rack (2.2.6.2)
    rack-protection (3.0.5)
      rack
    rack-test (2.0.2)
      rack (>= 1.3)
    rspec (3.12.0)
      rspec-core (~> 3.12.0)
      rspec-expectations (~> 3.12.0)
      rspec-mocks (~> 3.12.0)
    rspec-core (3.12.0)
      rspec-support (~> 3.12.0)
    rspec-expectations (3.12.2)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.12.0)
    rspec-mocks (3.12.3)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.12.0)
    rspec-support (3.12.0)
    ruby2_keywords (0.0.5)
    sequel (5.64.0)
    sinatra (3.0.5)
      mustermann (~> 3.0)
      rack (~> 2.2, >= 2.2.4)
      rack-protection (= 3.0.5)
      tilt (~> 2.0)
    sqlite3 (1.6.0-x86_64-linux)
    thread_safe (0.3.6)
    tilt (2.0.11)
    tzinfo (2.0.6)
      concurrent-ruby (~> 1.0)
    virtus (2.0.0)
      axiom-types (~> 0.1)
      coercible (~> 1.0)
      descendants_tracker (~> 0.0, >= 0.0.3)
    zeitwerk (2.6.6)

PLATFORMS
  x86_64-linux

DEPENDENCIES
  activesupport
  bcrypt
  bundler
  database_cleaner
  dotenv
  lotus-validations
  multi_json
  oj
  rack-test
  rom!
  rom-sql!
  rspec
  sinatra
  sqlite3
  virtus

BUNDLED WITH
   2.4.5

Am I missing a gem?

0

There are 0 best solutions below