Skip to content

Instantly share code, notes, and snippets.

@wuputah
Created November 2, 2013 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wuputah/7283522 to your computer and use it in GitHub Desktop.
Save wuputah/7283522 to your computer and use it in GitHub Desktop.
if Rails.env.development?
lambda do
forbidden_files = ['active_support/core_ext/object/to_json']
module Kernel
def require_with_dont_load_forbidden_files(name)
if forbidden_files.include?(name)
raise LoadError, "#{name} is forbidden"
end
require_without_dont_load_forbidden_files(name)
end
alias_method_chain :require, :dont_load_forbidden_files
end
forbidden_files.each do |f|
raise LoadError, "someone loaded a forbidden file: #{f}" if $".include?(f)
end
end.call
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment