Upgrade Notes for v0.9.0

config/environment.rb

require 'bundler/setup'
require 'hanami/setup'
require 'hanami/model' # Add this line
require_relative '../lib/bookshelf'
require_relative '../apps/web/application'

# This used to be `Hanami::Container.configure`, now it must be `Hanami.configure`
Hanami.configure do
  mount Web::Application, at: '/'

  # This is a new block
  #
  # Cut and paste the contents of `Hanami::Model.configure` from lib/bookshelf.rb
  model do

    # This used to be:
    #
    #   adapter type: :sql, url: ENV['DATABASE_URL']
    adapter :sql, ENV['DATABASE_URL']

    migrations 'db/migrations'
    schema     'db/schema.sql'

    #
    # Mapping block isn't supported anymore
    #
  end

  # This is a new block
  #
  # Cut and paste the contents of `Hanami::Mailer.configure` from lib/bookshelf.rb
  mailer do

    # Adjust the new layer `root` location
    root Hanami.root.join("lib", "bookshelf", "mailers")

    delivery do
      development :test
      test        :test
      # production :smtp, address: ENV['SMTP_PORT'], port: 1025
    end
  end
end

lib/bookshelf.rb

# This line is enough ;)
Hanami::Utils.require!("lib/bookshelf")

If you have any problem, don't hesitate to look for help in chat.


Prev: Upgrade Notes - v0.8.0
Next: Upgrade Notes - v1.0.0
Looking for Lotus? We renamed the project and it's now called Hanami. Read the announcement.