Skip to content

Instantly share code, notes, and snippets.

@rummelonp
Last active December 14, 2015 13:58
Show Gist options
  • Save rummelonp/5097280 to your computer and use it in GitHub Desktop.
Save rummelonp/5097280 to your computer and use it in GitHub Desktop.
rails console で reload! した時に lib も再読み込みするやつ
if defined?(Rails)
lib = File::join(Rails.root, 'lib')
ActiveSupport::Dependencies.autoload_paths << lib
Dir[lib + '/**'].each do |f|
class_name = File.basename(f).sub(/\.rb$/, '').camelize
ActiveSupport::Dependencies.explicitly_unloadable_constants << class_name
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment