# Rails development and dry-system

**URL:** <https://discourse.dry-rb.org/t/rails-development-and-dry-system/571>\
**Category:** Support\
**Created:** [June 8, 2018, 7:34pm UTC](https://discourse.dry-rb.org/t/rails-development-and-dry-system/571 "2018-06-08T19:34:31Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![aaricpittman](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/aaricpittman/32/266_2.png) [@aaricpittman](https://discourse.dry-rb.org/u/aaricpittman)\
**Post date:** [June 8, 2018, 7:34pm UTC](https://discourse.dry-rb.org/t/rails-development-and-dry-system/571/1 "2018-06-08T19:34:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![aaricpittman](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/aaricpittman/32/266_2.png) [@aaricpittman](https://discourse.dry-rb.org/u/aaricpittman)\
**Post date:** [June 11, 2018, 5:53pm UTC](https://discourse.dry-rb.org/t/rails-development-and-dry-system/571/2 "2018-06-11T17:53:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![solnic](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/solnic/32/779_2.png) [@solnic](https://discourse.dry-rb.org/u/solnic)\
**Post date:** [June 21, 2018, 12:28pm UTC](https://discourse.dry-rb.org/t/rails-development-and-dry-system/571/3 "2018-06-21T12:28:39Z")

</div>

This is super outdated, but we have a railtie for dry-system right here [https://github.com/dry-rb/dry-system-rails](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.

---

<div class="post-metadata">

**Author:** ![solnic](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/solnic/32/779_2.png) [@solnic](https://discourse.dry-rb.org/u/solnic)\
**Post date:** [December 18, 2018, 10:46am UTC](https://discourse.dry-rb.org/t/rails-development-and-dry-system/571/5 "2018-12-18T10:46:15Z")

</div>

This is a very rails-specific problem so monkey-patching `Container` is going to be the best solution (and of course extracting the require part into a separate method that can be overridden), simply because the alternative is to make the library more complex just to satisfy this one use case. Maybe in the future, we will discover that having a configurable “source loader” is useful, but for now, this is the only case. I’m more than happy to give you commit access to dry-system-rails and you can do whatever you need to do in order to make it work for you and others.

---

<div class="post-metadata">

**Author:** ![arielvalentin](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/arielvalentin/32/326_2.png) [@arielvalentin](https://discourse.dry-rb.org/u/arielvalentin)\
**Post date:** [December 18, 2018, 12:21pm UTC](https://discourse.dry-rb.org/t/rails-development-and-dry-system/571/6 "2018-12-18T12:21:00Z")

</div>

@solnic Thank you. I would be happy to work on the Railtie changes.

It sounds like you are amenable to having me open a PR against `dry-system` to extract a method around the `require` stament.

Is that correct?

---

<div class="post-metadata">

**Author:** ![solnic](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/solnic/32/779_2.png) [@solnic](https://discourse.dry-rb.org/u/solnic)\
**Post date:** [December 18, 2018, 12:32pm UTC](https://discourse.dry-rb.org/t/rails-development-and-dry-system/571/7 "2018-12-18T12:32:00Z")

</div>

> [@arielvalentin](#):
>
> It sounds like you are amenable to having me open a PR against `dry-system` to extract a method around the `require` stament.
> 
> Is that correct?

Yes, that’s what I implicitly meant too 😄

---

<div class="post-metadata">

**Author:** ![arielvalentin](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/arielvalentin/32/326_2.png) [@arielvalentin](https://discourse.dry-rb.org/u/arielvalentin)\
**Post date:** [December 18, 2018, 3:31pm UTC](https://discourse.dry-rb.org/t/rails-development-and-dry-system/571/8 "2018-12-18T15:31:23Z")

</div>

Thanks. I will go ahead and do that.

---

<div class="post-metadata">

**Author:** ![arielvalentin](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/arielvalentin/32/326_2.png) [@arielvalentin](https://discourse.dry-rb.org/u/arielvalentin)\
**Post date:** [January 2, 2019, 3:46pm UTC](https://discourse.dry-rb.org/t/rails-development-and-dry-system/571/9 "2019-01-02T15:46:44Z")

</div>

@solnic Thanks for accepting the PR!

Are you still amenable to granting me commit access to `dry-system-rails`?

Do you feel like it is something that should be part of the `dry` eco-system or would you prefer it to be managed/maintained by another group/org?
