Module: Deflect
- Defined in:
- lib/deflect.rb,
lib/deflect/railtie.rb,
lib/deflect/version.rb
Defined Under Namespace
Classes: Railtie
Constant Summary collapse
- VERSION =
"0.0.1"
Class Method Summary collapse
Class Method Details
.patch_plural_constant_lookup! ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/deflect.rb', line 4 def self.patch_plural_constant_lookup! ActiveSupport::Dependencies.define_singleton_method :load_missing_constant do |from_mod, const_name| begin super from_mod, const_name rescue NameError => e singular = const_name.to_s.singularize if const_name.to_s == singular raise else Rails.logger.debug "Did you mean `#{singular}`?" from_mod.const_get singular end end end end |