Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Reload Rails code in development mode only when change is deteced
Ruby JavaScript
tag: v0.1.0

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


Active Reload

Active Reload is a gem that changes a little when Rails code reloading is executed.
Normally Rails “forgets” your code after every request in development mode and loads again necessary
files during the request. If your application is big this can take lot of time especially on “dashboard” page
that uses lot of different classes.

However this constant reloading is not always necessary. This gem changes it so it occurs
before request and only when file was changed or added. It won’t make reloading your app
faster but it will skip reloading when nothing changed and that saved second can really sum
up to a big value. It means that after change first request in development mode will reload the code
and take as much time as it takes without this gem but subsequent request will be faster until next
changes due to lack of code reloading.


Simply add Active Reload to your Gemfile and bundle it up:

  gem 'active_reload'


It was hand tested only with Rails 3.0.9 but should work without any problem on any 3.0.* version.
Expect 3.1.* support soon :-) !


You can subscribe to two notifications provided by this gem.

active_reload.set_clear_dependencies_hook_replaced event is triggered when the gem changes original rails hook for code reloading.

ActiveSupport::Notifications.subscribe("active_reload.set_clear_dependencies_hook_replaced") do |*args|
  event =*args)
  msg =
  # Ubuntu:, Example: => msg, :summary =>, :timeout => 2.5, :append => true)
  # Macos:
  puts Rails.logger.warn(" --- #{msg} --- ")

active_support.dependencies.clear event is triggered when code reloading is triggered by this gem.

ActiveSupport::Notifications.subscribe("active_support.dependencies.clear") do |*args|
  msg = "Code reloaded!"
  # Ubuntu:, Example: => msg, :summary =>, :timeout => 2.5, :append => true)
  # Macos:
  puts" --- #{msg} --- ")

Something went wrong with that request. Please try again.