rom-rb / rom

Data mapping and persistence toolkit for Ruby
https://rom-rb.org
MIT License
2.09k stars 161 forks source link

MissingAdapterIdentifierError raised Gateway#adapter #388

Closed abrthel closed 7 years ago

abrthel commented 7 years ago

Adapter method for rom-sql gateway is raising an exception instead of returning a symbol.

# frozen_string_literal: true
require 'bundler'
Bundler.setup

require 'rom'
require 'rom/sql'

ROM::VERSION             # => "3.1.0"
ROM::SQL::VERSION        # => "1.2.1"

rom = ROM.container(:sql, 'sqlite::memory') do |conf|
  conf.default.create_table(:users) do
    primary_key :id
    column :name, String, null: false
  end
end

rom.gateways[:default].adapter

# gems/rom-0483351bcb2f/lib/rom/gateway.rb:116:in `adapter': gateway class +#<ROM::SQL::Gateway:0x000000045f2860>+ is missing the adapter identifier
#  (ROM::MissingAdapterIdentifierError)
flash-gordon commented 7 years ago

I added an adapter check to the gateway linter, so that now having this required for all adapters. rom-sql updated in https://github.com/rom-rb/rom-sql/commit/aeda48f5342827f47b95a65cb478e79a06202ddc