Skip to content

Instantly share code, notes, and snippets.

@oriolbcn
Created July 25, 2018 09:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save oriolbcn/5e4d41e2c86ec263191c1690788f3a75 to your computer and use it in GitHub Desktop.
Save oriolbcn/5e4d41e2c86ec263191c1690788f3a75 to your computer and use it in GitHub Desktop.
Reload gem from library in Rails 5+
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