Created
July 11, 2012 14:28
-
-
Save jumski/3090722 to your computer and use it in GitHub Desktop.
Rails 3: reload custom files at each request (or in console using reload!)
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
if Rails.env.development? | |
decorator_paths = Dir['app/**/*_decorator.rb'] | |
decorators_reloader = ActiveSupport::FileUpdateChecker.new(decorator_paths) do | |
decorator_paths.each { |path| load path } | |
end | |
ActionDispatch::Callbacks.to_prepare do | |
decorators_reloader.execute_if_updated | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment