Sha256: e7ab7c9c519474eec009d2baaf9e9e4488c05691c9c22a89d4431d43f9b7c506

Contents?: true

Size: 552 Bytes

Versions: 3

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('Credere::' + model_name)

    models_dir = File.dirname(__FILE__) + '/../../app/models/credere/'
    path = File.expand_path(models_dir + model_name.downcase + '.rb')
    $LOADED_FEATURES.delete(path)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
credere-0.10.3 spec/support/active_support_helpers.rb
credere-0.10.2 spec/support/active_support_helpers.rb
credere-0.10.1 spec/support/active_support_helpers.rb