Module: SupportTable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/support_table.rb,
lib/support_table/definition.rb,
lib/support_table/belongs_to_support_table.rb
Overview
Include this module to add the ability to define support tables in ActiveRecord models.
This will add the support_table and belongs_to_support_table class methods to the model.
A support table is a table that contains a fixed set of data that is used to support the application. This data is typically loaded from a data file (YAML, JSON, or CSV) and is intended to be read-only. Support tables are also usually small and can be cached in memory for fast access.
You would normally just include this module in your ApplicationRecord class. However,
you can also include it in individual models.
Defined Under Namespace
Modules: BelongsToSupportTable, ClassMethods Classes: Definition
Constant Summary collapse
- VERSION =
File.read(File.join(__dir__, "../VERSION")).strip
Class Method Summary collapse
-
.cache=(cache_impl) ⇒ void
Set the cache used on support tables.
-
.data_directory=(dir) ⇒ void
Set the directory where data files are stored.
-
.sync_all!(*classes) ⇒ void
Sync all support tables.
Class Method Details
.cache=(cache_impl) ⇒ void
This method returns an undefined value.
Set the cache used on support tables. See SupportTableCache for details. This is an
alias for SupportTableCache.cache=.
111 112 113 |
# File 'lib/support_table.rb', line 111 def cache=(cache_impl) SupportTableCache.cache = cache_impl end |
.data_directory=(dir) ⇒ void
This method returns an undefined value.
Set the directory where data files are stored. See SupportTableData for details.
This is an alias for SupportTableData.data_directory=.
92 93 94 |
# File 'lib/support_table.rb', line 92 def data_directory=(dir) SupportTableData.data_directory = dir end |
.sync_all!(*classes) ⇒ void
This method returns an undefined value.
Sync all support tables. See SupportTableData for details. This is an alias for
SupportTableData.sync_all!.
102 103 104 |
# File 'lib/support_table.rb', line 102 def sync_all!(*classes) SupportTableData.sync_all!(*classes) end |