Skip to content

Instantly share code, notes, and snippets.

@makefunstuff
Created March 9, 2017 16:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makefunstuff/3df5742f54a4a6bb75116966567938f1 to your computer and use it in GitHub Desktop.
Save makefunstuff/3df5742f54a4a6bb75116966567938f1 to your computer and use it in GitHub Desktop.
unless Rails.env.production?
bot_files = Dir[Rails.root.join('app', 'messenger_bot', '**', '*.rb')]
bot_reloader = ActiveSupport::FileUpdateChecker.new(bot_files) do
bot_files.each{ |file| require_dependency file }
end
ActionDispatch::Callbacks.to_prepare do
bot_reloader.execute_if_updated
end
bot_files.each { |file| require_dependency file }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment