Created
July 25, 2018 09:19
-
-
Save oriolbcn/5e4d41e2c86ec263191c1690788f3a75 to your computer and use it in GitHub Desktop.
Reload gem from library in Rails 5+
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if Rails.env.development? | |
localistico_files = Dir['lib/localistico/*.rb'] + ['lib/localistico.rb'] | |
reloader = ActiveSupport::FileUpdateChecker.new(localistico_files) do | |
localistico_files.each { |file| load file } | |
end | |
ActiveSupport::Reloader.to_prepare do | |
reloader.execute_if_updated | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment