Created
April 15, 2011 11:03
-
-
Save paneq/921526 to your computer and use it in GitHub Desktop.
Changed piece of railties-3.0.7.rc1/lib/rails/application/bootstrap.rb Clear dependencies before request only when some changes were made to any file observed by watchr.
This file contains 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
initializer :set_clear_dependencies_hook do | |
unless config.cache_classes | |
changed_at = Proc.new{ File.new(File.join(Rails.root, '.watchr')).mtime } | |
last_change = changed_at.call | |
ActionDispatch::Callbacks.before do | |
change = changed_at.call | |
if change > last_change | |
Rails.logger.info("DETECTED CHANGES") | |
last_change = change | |
ActiveSupport::DescendantsTracker.clear | |
ActiveSupport::Dependencies.clear | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment