One quick way to deal with this is to use 'require_dependency' instead of simply 'require'.
require 'foo'
require_dependency 'foo'
But when it comes time to migrate your code to production, you don't want the 'require_dependency' statement because it could really impact performance.
One solution seemed to suggest adding extra code in environments.rb
Dependencies.load_paths
Dependencies.explicitly_unloadable_constants
I haven't been able to get this to work successfully, so in the meantime, I will temporarily change 'require' to 'require_dependency' when I'm working with code in a library resource.Another posting provided me with the 'require_dependency' option listed above (giving credit where credit is due).
No comments:
Post a Comment