Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force code reloading before each request

I'm using Ruby on Rails 5 and I'm wondering how can I force code reloading before each request. The reason I need this is that I'm using Docker on Mac and my code lives in a NFS folder, thus the Rails mechanism for detecting code changes isn't working properly and I must reboot rails after each code change.

So, my question is: How can I force Rails to reload my code before each request?

like image 317
alexandernst Avatar asked Aug 25 '26 19:08

alexandernst


1 Answers

You can consider using the rerun gem. This will allow you to reload a rack application on code change. Since Rails is basically a complex rack application this should work.

This will reload the entire(!) rails application every time, but it will reload.

I'm currently using it in a grape API, where I'm running it like this, and you should be able to run your rails application the same way.

bundle exec rerun 'rackup'

PS: You might want additional parameters such as port, etc. there as well.

like image 62
ekampp Avatar answered Aug 28 '26 10:08

ekampp



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!