GithubHelp home page GithubHelp logo

Comments (10)

excid3 avatar excid3 commented on June 2, 2024 2

This took some serious time to figure out but I got it working. 🔥

from madmin.

arschrier avatar arschrier commented on June 2, 2024 1

Spoke too soon! Thought this was related to Zeitwerk itself, but it appears this has to do with the way Rails now auto loads paths.

This is the breaking commit from Rails: rails/rails@2306a8e.

I am not an expert here, but is Rails eager loading the directory before engines are initialized?

from madmin.

mattpolito avatar mattpolito commented on June 2, 2024 1

@excid3 of course... trying to figure it out myself :-)

from madmin.

excid3 avatar excid3 commented on June 2, 2024 1

I had to dig through the Rails source code to figure it out. Couldn't find any examples or anything. The previous stuff was what I had found in a blog post, but this works consistently across all Rails versions using before_configuration. I didn't even know that was a callback you could use until I started reading the Rails source. 😅

from madmin.

arschrier avatar arschrier commented on June 2, 2024

Telling Rails to collapse the resources directory fixed the issue. I did so by adding the following to config/application.rb:

Rails.autoloaders.main.collapse('app/madmin/resources')

from madmin.

excid3 avatar excid3 commented on June 2, 2024

Is this something that changed specifically in Zeitwerk 2.5?

from madmin.

excid3 avatar excid3 commented on June 2, 2024

Could be that the Madmin initializer isn't running early enough now. We do a similar thing to make sure the autoload paths are added before they get frozen.

https://github.com/excid3/madmin/blob/master/lib/madmin/engine.rb#L3

from madmin.

mattpolito avatar mattpolito commented on June 2, 2024

Can confirm... resource loading does not appear to work in Rails 7 alpha

from madmin.

excid3 avatar excid3 commented on June 2, 2024

PRs welcome if you figure out what's going on. 👍

from madmin.

mattpolito avatar mattpolito commented on June 2, 2024

@excid3 did you come across something that shows path loading needs to happen 'before configuration' or was that just the hook placement that ended up working?

from madmin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.