I've recently switched to Zeitwerk & am gettin...
# support
j
I've recently switched to Zeitwerk & am getting:
NameError: uninitialized constant SolidusRelatedProducts::Product::RSpec
but only during a heroku deploy -- anyone seen such a thing?
j
Is there accidentally a spec in you app folder or something... or in solidus_related_product's app folder?
j
i'll take a quick peek at the gem
I don't think so... Their gem looks totally clean -- im thinking it might be how i load overrides:
Copy code
overrides = Rails.root.join('**/decorators')
    Rails.autoloaders.main.ignore(overrides)
    config.to_prepare do
      Dir.glob("#{overrides}/**/*.rb").each do |override|
        load override
      end
    end
^ does this run against gem files in addition to my app perhaps? this is in application.rb -- i pulled this example from the "upgrade to zeitwerk" examples from the rails guides
cause i'm seeing this load fail is from a
spec/decorators
folder in the gem... must be this
j
lol yeah, that'll load stuff out of the specs
j
hmm -- is there a "solidus way" of handling overrides i'm not aware of?
i do like
models/decorators
or
controllers/decorators
to decorate the solidus stuff
j
Copy code
overrides = Rails.root.join('app/**/decorators')
j
derp... you so smart Jared I want to work with you one day
☺️ 1
😄 1
i'll give it a shot thanks for the input / help!
sg horns 1
yeah that totally fixed it i only wasted two days on it though before asking for help so that's actually an improvement for me LOL
had no idea that code would run against gems
a
Just to chime in, as far as I can tell Solidus has also moved to the pattern where
app/overrides
exists (and is already included in the loader), and in there you can add directories for
models
,
controller
, etc that you want to override. Part of the reasoning behind this that I read was firstly to standardise how overrides are done, but also to distinguish between overrides and decorators a little more. I'm not a contributor so anyone please correct me if I'm wrong.
j
Yeah, that's the preferred way. Avoids a lot of confusion
j
awesome i'll consider moving to that style -- it's a bit clunky though cause a large percentage of solidus apps are overrides?
but it would have avoided this issue nicely i'll definitely admit