Questions tagged [zeitwerk]
68 questions
0
votes
1 answer
Best place for Middlewares on Rails 6
I'm currently on Rais 6 and using middlewares. I've something working but I don't like it. How should I improve it?
Currently my middlewares are here:
app/middleware/my_middleware.rb
And on config/application.rb I'm calling
require_relative…

brcebn
- 1,571
- 1
- 23
- 46
0
votes
1 answer
Rails 7 Autoloading problem with active job
I have an app directory in my Rails 7 App, app/beer, and in that folder a file named cool.rb with a defined method execute.
So in an ActiveJob DrinkSudsJob perform method I am calling a method execute from cool.rb as:
def perform
…

David Lazar
- 10,865
- 3
- 25
- 38
0
votes
1 answer
Zeitwerk and Modules Nested in Classes
I'm having some trouble switching from the classic autoloader to Zeitwerk with a Rails app that's seen the light of day back in Rails 3 days – so there's some crust there.
Some model code has been extracted to modules and these modules are nested in…

svoop
- 3,318
- 1
- 23
- 41
0
votes
1 answer
unable to use a compact style of module and class under test folder (NameError)
I have folder insider test/fixtures/schemas where I define some schemas that I use to validate the JSON response of some controllers like this:
test
|
|
controllers
|
|
....
fixtures
|
|
organizations.yml
…

Luiz E.
- 6,769
- 10
- 58
- 98
0
votes
1 answer
How to access ApplicationHelper methods in namespaced views?
I have a module ApplicationHelper in app/helpers/application_helper.rb
defined like this
module ApplicationHelper
def some_method(arg)
end
end
and i have my view file is here
app/views/v1/admin/messages/show.json.jbuilder
So i am trying…

Prateek Vyas
- 71
- 9
0
votes
1 answer
Heroku app deployed successfully, but receiving application error when loading site
M receiving following error message while opening the app.........
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the…

Vineet
- 11
- 3
0
votes
1 answer
Rails custom project structure autoloading configs
I have a standard app that contains of sub-apps that we will slowly migrate into separate gems. The main problem is that each sub-app basically has an almost identical schema and very similar business logic that sometimes is really pretty much the…

George Morris
- 433
- 4
- 17
0
votes
1 answer
NoMethodError: undefined method `eager_load_paths' for #
In my rails 6 app running ruby 2.7, I am trying to eager load all the files using Zeitwerk. Here is a snippet of my application.rb file:
class Application < Rails::Application
config.load_defaults "6.0"
Zeitwerk::Loader.eager_load_all
# Application…