Avoid problems with constantize returning unexpected results
If in development environment you face problem with constantize
returning some unexpected results as mentioned in this issue, there is primitive, yet simple workaround.
Just place following code in any initializer
if Rails.env.development?
ActiveSupport::Inflector.class_eval do
def constantize_with_double_call(camel_cased_word)
constantize_without_double_call(camel_cased_word) && constantize_without_double_call(camel_cased_word)
end
alias_method_chain :constantize, :double_call
end
end
Written by Błażej Kosmowski
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#