Module: IronTrail
- Extended by:
- Forwardable
- Defined in:
- lib/iron_trail/version.rb,
lib/iron_trail.rb,
lib/iron_trail/model.rb,
lib/iron_trail/config.rb,
lib/iron_trail/railtie.rb,
lib/iron_trail/migration.rb,
lib/iron_trail/reflection.rb,
lib/iron_trail/association.rb,
lib/iron_trail/db_functions.rb,
lib/iron_trail/testing/rspec.rb,
lib/iron_trail/metadata_store.rb,
lib/iron_trail/query_transformer.rb,
lib/iron_trail/sidekiq_middleware.rb,
lib/iron_trail/change_model_concern.rb,
lib/generators/iron_trail/migration_generator.rb
Overview
frozen_literal_string: true
Defined Under Namespace
Modules: ChangeModelConcern, Migration, Model, SchemaDumper, Testing Classes: Association, Config, DbFunctions, MetadataStore, MigrationGenerator, QueryTransformer, Railtie, Reflection, SidekiqMiddleware
Constant Summary collapse
- OWN_TABLES =
These tables are owned by IronTrail and will be in the default ignore list
%w[ irontrail_trigger_errors irontrail_changes ].freeze
- VERSION =
'0.0.2'
Class Attribute Summary collapse
-
.query_transformer ⇒ Object
readonly
Returns the value of attribute query_transformer.
Class Method Summary collapse
- .config {|@config| ... } ⇒ Object
- .enabled? ⇒ Boolean
- .ignore_table?(name) ⇒ Boolean
- .post_schema_load(context, missing_tracking: nil) ⇒ Object
- .setup_active_record ⇒ Object
- .store_instance ⇒ Object
Class Attribute Details
.query_transformer ⇒ Object (readonly)
Returns the value of attribute query_transformer.
41 42 43 |
# File 'lib/iron_trail.rb', line 41 def query_transformer @query_transformer end |
Class Method Details
.config {|@config| ... } ⇒ Object
43 44 45 46 47 |
# File 'lib/iron_trail.rb', line 43 def config @config ||= IronTrail::Config.instance yield @config if block_given? @config end |
.enabled? ⇒ Boolean
49 50 51 |
# File 'lib/iron_trail.rb', line 49 def enabled? config.enable end |
.ignore_table?(name) ⇒ Boolean
def test_mode!
if [ENV['RAILS_ENV'], ENV['RACK_ENV']].include?('production')
raise "IronTrail test mode cannot be enabled in production!"
end
@test_mode = true
end
def test_mode?
@test_mode
end
64 65 66 |
# File 'lib/iron_trail.rb', line 64 def ignore_table?(name) (OWN_TABLES + (config.ignored_tables || [])).include?(name) end |
.post_schema_load(context, missing_tracking: nil) ⇒ Object
68 69 70 71 72 73 74 75 |
# File 'lib/iron_trail.rb', line 68 def post_schema_load(context, missing_tracking: nil) df = IronTrail::DbFunctions.new(context.connection) df.install_functions missing_tracking.each do |table| df.enable_tracking_for_table(table) end end |
.setup_active_record ⇒ Object
77 78 79 80 81 82 83 |
# File 'lib/iron_trail.rb', line 77 def setup_active_record ActiveRecord::Migration.prepend(IronTrail::Migration) ActiveRecord::SchemaDumper.prepend(IronTrail::SchemaDumper) @query_transformer = QueryTransformer.new @query_transformer.setup_active_record end |
.store_instance ⇒ Object
85 86 87 |
# File 'lib/iron_trail.rb', line 85 def store_instance @store_instance ||= MetadataStore.new end |