Module: ConstantTableSaver::ClassMethods

Defined in:
lib/constant_table_saver.rb

Instance Method Summary collapse

Instance Method Details

#reset_constant_record_cache!Object

Resets the cached records. Remember that this only affects this process, so while this is useful for running tests, it’s unlikely that you can use this in production - you would need to call it on every Rails instance on every Rails server. Don’t use this plugin on if the table isn’t really constant!



46
47
48
49
# File 'lib/constant_table_saver.rb', line 46

def reset_constant_record_cache!
  @constant_record_methods.each {|method_id| (class << self; self; end;).send(:remove_method, method_id)} if @constant_record_methods
  @cached_records = @cached_records_by_id = @constant_record_methods = @cached_blank_scope = @find_by_sql = nil
end