Sha256: e2a2734d714d0b6e009de5da4a3dd0d9a76d1e531f20f0b0f2b51c8aa760e192

Contents?: true

Size: 550 Bytes

Versions: 11

Compression:

Stored size: 550 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('Plutus::' + model_name)

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

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
plutus-0.17 spec/support/active_support_helpers.rb
plutus-0.16 spec/support/active_support_helpers.rb
plutus-0.15 spec/support/active_support_helpers.rb
plutus-0.14 spec/support/active_support_helpers.rb
tyche-0.14 spec/support/active_support_helpers.rb
odania_plutus-0.13 spec/support/active_support_helpers.rb
plutus-0.13 spec/support/active_support_helpers.rb
plutus-0.12.2 spec/support/active_support_helpers.rb
plutus-0.11.0 spec/support/active_support_helpers.rb
plutus-0.10.1 spec/support/active_support_helpers.rb
plutus-0.10.0 spec/support/active_support_helpers.rb