For an engine:
module Copycat
class Engine < ::Rails::Engine
if Rails.env.development?
config.to_prepare do
Rails.logger.debug "RELOADING COPYCAT"
require_dependency Copycat::Engine.root.join('lib', 'copycat').to_s
end
config.after_initialize do
# optional, without it will call `to_prepend` only when a file changes,
# not on every request
Rails.application.config.reload_classes_only_on_change = false
end
end
end
end