dry-rb / dry-rails

The official dry-rb railtie
https://dry-rb.org/gems/dry-rails
MIT License
270 stars 27 forks source link

ApplicationContract is not defined. Rails 7.1.2 #62

Open alexeevit opened 10 months ago

alexeevit commented 10 months ago

Describe the bug

Hey, I ran into an issue when with a clean setup I don't have defined ApplicationContract. This is my first time using dry-rails, maybe I'm doing something wrong? Demo app link is below.

UPD:

To Reproduce

$ rails new myapp --minimal
$ bundle add dry-rails
$ bin/rails c
irb(main):001> ApplicationContract
(irb):1:in `<main>': uninitialized constant ApplicationContract (NameError)

Demo app

My environment

iwdt commented 8 months ago

@alexeevit to solve this problem, you can create a file app/contracts/application_contract.rb with:

# frozen_string_literal: true

# Base class for contracts
#
# @abstract
class ApplicationContract < Dry::Rails::Features::ApplicationContract
end
alexeevit commented 8 months ago

@alexeevit to solve this problem, you can create a file app/contracts/application_contract.rb with:

# frozen_string_literal: true

# Base class for contracts
#
# @abstract
class ApplicationContract < Dry::Rails::Features::ApplicationContract
end

Indeed, I can. It's just a good thing to report a bug