Rails development and dry-system


#1

I’m working on breaking a part a rails app and making use of dry-system. Everything is working great so far, except I cannot figure out how to get it working with Rails’ constant reloading in development. Has anyone done this successfully or have suggestions on where I might start?

Thanks,
Aaric


#2

What I’ve come up with so far is defining a require method on the module like such:

def self.require(path)
  if defined?(Rails)
    require_dependency(path)
  else
    require(path)
  end
end

and using that for my require statements. Would love to hear thoughts on doing it this way.


#3

This is super outdated, but we have a railtie for dry-system right here https://github.com/dry-rb/dry-system-rails Maybe it’d be worth seeing if a proper setup for code reloading could be added to this railtie.