Class: ConstantRecord::Base
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- ConstantRecord::Base
- Extended by:
- Associations, DataLoading
- Includes:
- ReadOnly
- Defined in:
- lib/constant_record.rb
Overview
Base class to inherit from so we can share the same memory database
Class Method Summary collapse
-
.connection ⇒ Object
Reload table if connection changes.
Methods included from DataLoading
data, data_file, load, load_data, loaded?, reload!
Methods included from Associations
Methods included from ReadOnly
#delete, #destroy, included, #readonly?
Class Method Details
.connection ⇒ Object
Reload table if connection changes. Since it’s in-memory, a connection change means the the table gets wiped.
224 225 226 227 228 229 230 231 |
# File 'lib/constant_record.rb', line 224 def self.connection conn = super if (@previous_connection ||= conn) != conn @previous_connection = conn # avoid infinite loop reload_memory_table end conn end |