title: hanami-model integration to ruby project
body: <p>structure of my application:</p>
  
  <pre><code>.
  ├── config
  │   ├── boot.rb
  │   └── environment.rb
  ├── Gemfile
  ├── Gemfile.lock
  ├── lib
  │   ├── entities
  │   │   └── account.rb
  │   └── repositories
  │       └── account_repository.rb
  └── README.md
  </code></pre>
  
  <p>Gemfile:</p>
  
  <pre><code>source 'https://rubygems.org'
  
  gem 'pg', '~&gt; 1.1'
  gem 'dotenv'
  gem 'byebug'
  gem 'hanami-model'
  </code></pre>
  
  <p>config/environment.rb:</p>
  
  <pre><code>require 'bundler/setup'
  require 'hanami/model'
  require 'dotenv/load'
  
  class App
    class &lt;&lt; self
      def boot
        Mutex.new.synchronize do
          Hanami::Model.configure do
            adapter :sql, ENV['DATABASE_URL']
          end.load!
        end
      end
    end
  end
  </code></pre>
  
  <p>config/boot.rb:</p>
  
  <pre><code>require_relative './environment'
  App.boot
  </code></pre>
  
  <p>lib/entities/account.rb:</p>
  
  <pre><code>require 'hanami/model'
  require_relative '../repositories/account_repository'
  
  class Account &lt; Hanami::Entity
  end
  </code></pre>
  
  <p>lib/repositories/account_repository.rb:</p>
  
  <pre><code>require 'hanami/model'
  require_relative '../entities/account'
  
  class AccountRepository &lt; Hanami::Repository
     self.relation = :accounts
  end
  </code></pre>
  
  <p>in the console, I run the following code, and I get an error:</p>
  
  <pre><code>irb -I .
  irb(main):001:0&gt; require 'config/boot'
  =&gt; true
  irb(main):002:0&gt; require 'lib/repositories/account_repository'
  =&gt; true
  irb(main):003:0&gt; rep = AccountRepository.new
  Traceback (most recent call last):
          6: from /home/mvalitov/.asdf/installs/ruby/2.5.1/bin/irb:11:in `&lt;main&gt;'
          5: from (irb):3
          4: from (irb):3:in `new'
          3: from /home/mvalitov/.asdf/installs/ruby/2.5.1/lib/ruby/gems/2.5.0/gems/hanami-model-1.3.2/lib/hanami/repository.rb:420:in `initialize'
          2: from /home/mvalitov/.asdf/installs/ruby/2.5.1/lib/ruby/gems/2.5.0/gems/rom-repository-1.4.0/lib/rom/repository/root.rb:62:in `initialize'
          1: from /home/mvalitov/.asdf/installs/ruby/2.5.1/lib/ruby/gems/2.5.0/gems/rom-3.3.3/lib/rom/registry.rb:30:in `fetch'
  ArgumentError (key cannot be nil)
  </code></pre>
  
  <p>what am I doing wrong? if you put all the entity code and repositories in one file, the code runs without errors.</p>