Sha256: 49bd336aac8e8d13462cb5f5ca2243df42d9f1ea056916b0c1b8e66e0ae5507e
Contents?: true
Size: 552 Bytes
Versions: 7
Compression:
Stored size: 552 Bytes
Contents
module ActiveSupportHelpers # Helps in removing model, and force-reloading it next time This helper does 2 # things: # * remove from $LOADED_FEATURES so that ruby 'require' reloads file again # * remove the constant from active support dependencies def self.clear_model(model_name) ActiveSupport::Dependencies.remove_constant('Borutus::' + model_name) models_dir = File.dirname(__FILE__) + '/../../app/models/borutus/' path = File.expand_path(models_dir + model_name.downcase + '.rb') $LOADED_FEATURES.delete(path) end end
Version data entries
7 entries across 7 versions & 1 rubygems