Module: PgRls::ActiveRecord::Migration::CommandRecorder

Defined in:
lib/pg_rls/active_record/migration/command_recorder.rb

Overview

ActiveRecord Migration Command Recorder Extension

Constant Summary collapse

REVERSIBLE_AND_IRREVERSIBLE_METHODS =
i[
  create_rls_tenant_table convert_to_rls_tenant_table drop_rls_tenant_table
  create_rls_table convert_to_rls_table drop_rls_table
].freeze

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/pg_rls/active_record/migration/command_recorder.rb', line 13

def self.included(base)
  REVERSIBLE_AND_IRREVERSIBLE_METHODS.each do |method|
    base.class_eval "      def \#{method}(*args, &block)          # def create_table(*args, &block)\n        record(:\"\#{method}\", args, &block)  #   record(:create_table, args, &block)\n      end                                   # end\n    RUBY\n    base.send(:ruby2_keywords, method)\n  end\nend\n", __FILE__, __LINE__ + 1