Module: Switchman::ActiveRecord::PostgreSQLAdapter::ClassMethods
- Defined in:
- lib/switchman/active_record/postgresql_adapter.rb
Instance Method Summary collapse
Instance Method Details
#quote_local_table_name(name) ⇒ Object
77 78 79 80 81 82 |
# File 'lib/switchman/active_record/postgresql_adapter.rb', line 77 def quote_local_table_name(name) # postgres quotes tables and columns the same; just pass through # (differs from quote_table_name_with_shard below by no logic to # explicitly qualify the table) quote_column_name(name) end |
#quote_table_name(name, shard: nil) ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/switchman/active_record/postgresql_adapter.rb', line 84 def quote_table_name(name, shard: nil) # This looks kind of weird at first glance, but older Rails versions do not actually import # these methods as class methods. shard = self.shard if shard.nil? && ::Rails.version < "7.2" && !@use_local_table_name return quote_local_table_name(name) unless shard name = ::ActiveRecord::ConnectionAdapters::PostgreSQL::Utils.extract_schema_qualified_name(name.to_s) name.instance_variable_set(:@schema, shard.name) unless name.schema name.quoted end |