Hi everyone
I am trying to config rom-factory.
I have created app and put provider
Hanami.app.register_provider :persistence, namespace: true do
prepare do
require ‘rom-changeset’
require ‘rom/core’
require ‘rom/sql’
config =
ROM::Configuration.new(
:sql, target['settings'].database_url
)
register 'config', config
register 'db', config.gateways[:default].connection
end
start do
config = target[‘persistence.config’]
config.auto_registration(
target.root.join('relations'),
namespace: 'MyApp::Relations'
)
register 'rom', ROM.container(config)
end
end
also I configure factory
require “rom-factory”
require “faker”
Factory = ROM::Factory.configure do |config|
config.rom = MyApp::Container[“persistence.rom”]
end
Dir[File.dirname(FILE) + “/factories/*.rb”].each { |file| require file }
and created factory
Factory.define(:users) do |f|
f.sequence(:name) { |n| “name #{n}” }
end
but I got error
ROM::ElementNotFoundError:
:users doesn’t exist in ROM::RelationRegistry registry
Could you give me information how to config rom-factory correctly?