Module: Hoardable
- Defined in:
- lib/hoardable/engine.rb,
lib/hoardable/error.rb,
lib/hoardable/model.rb,
lib/hoardable/scopes.rb,
lib/hoardable/has_one.rb,
lib/hoardable/version.rb,
lib/hoardable/has_many.rb,
lib/hoardable/rich_text.rb,
lib/hoardable/belongs_to.rb,
lib/hoardable/associations.rb,
lib/hoardable/source_model.rb,
lib/hoardable/arel_visitors.rb,
lib/hoardable/has_rich_text.rb,
lib/hoardable/schema_dumper.rb,
lib/hoardable/version_model.rb,
lib/hoardable/finder_methods.rb,
lib/hoardable/database_client.rb,
lib/hoardable/schema_statements.rb,
lib/hoardable/encrypted_rich_text.rb,
lib/generators/hoardable/install_generator.rb,
lib/generators/hoardable/migration_generator.rb
Overview
An ActiveRecord
extension for keeping versions of records in uni-temporal inherited tables.
Defined Under Namespace
Modules: ArelVisitors, Associations, FinderMethods, Model, Scopes, SourceModel, VersionModel Classes: CreatedAtColumnMissingError, EncryptedRichText, Engine, Error, InstallGenerator, InvalidTemporalUpperBoundError, MigrationGenerator, RichText, UpdatedAtColumnMissingError
Constant Summary collapse
- REGISTRY =
Set.new
- DATA_KEYS =
Symbols for use with setting contextual data, when creating versions. See README for more.
%i[meta whodunit event_uuid].freeze
- CONFIG_KEYS =
%i[enabled version_updates save_trash].freeze
- VERSION =
"0.17.0"
Class Method Summary collapse
-
.at(datetime) ⇒ Object
Allows performing a query for record states at a certain time.
-
.travel_to(datetime) ⇒ Object
Allows calling code to set the upper bound for the temporal range for recorded audits.
-
.with(hash) ⇒ Object
This is a general use method for setting Contextual Data or Configuration around a block.
Class Method Details
.at(datetime) ⇒ Object
Allows performing a query for record states at a certain time. Returned SourceModel instances within the block may be SourceModel or VersionModel records.
77 78 79 80 81 82 |
# File 'lib/hoardable/engine.rb', line 77 def at(datetime) @at = datetime yield ensure @at = nil end |
.travel_to(datetime) ⇒ Object
Allows calling code to set the upper bound for the temporal range for recorded audits.
87 88 89 90 91 92 |
# File 'lib/hoardable/engine.rb', line 87 def travel_to(datetime) @travel_to = datetime yield ensure @travel_to = nil end |
.with(hash) ⇒ Object
This is a general use method for setting Contextual Data or Configuration around a block.
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/hoardable/engine.rb', line 62 def with(hash) current_config = @config current_context = @context @config = current_config.merge(hash.slice(*CONFIG_KEYS)) @context = current_context.merge(hash.slice(*DATA_KEYS)) yield ensure @config = current_config @context = current_context end |