switchman 1.13.2 → 1.13.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f0444c8114ea5df8627ea4124a5c99c0aafd64840493f6e410fade341bedb24
4
- data.tar.gz: 44176439003933f030ba0eac73b46dbe7aa6a9a9712c4a9359027d20c7948296
3
+ metadata.gz: ec8bd036f45f143718da9a25f56578e9d79217ce053df66eb828eafe5f2edd15
4
+ data.tar.gz: '0236808209e855742dc8caaf113176d6b6045db37c782c0e6eff69e8ae422370'
5
5
  SHA512:
6
- metadata.gz: 2771dd0ecf117e53a327a9c9092b6efca169fc9dfadc63efc486d401c00646eda3e2a819d3a783ac2be4cd971929366f2c6187fffe5b48f8f674c6cc94eea333
7
- data.tar.gz: a2eaae7a569c79abdd0658390d28d3272767d586a78c3bf19bf616eeaefe65ca774d0d6d5ff49a4241cfc7149f274881f42da5dd6d791fb98c9aa97a98af463c
6
+ metadata.gz: a97ccc3066a172dc3261008b7ceca6e25dc8d352cbaec9ea1e3db383ce7a0cd4fe188f74522e503e16e40c60709338953671e1e4e99c90a46d13079546abea3a
7
+ data.tar.gz: 62a28505e8c5fd3731de3d5ccf84b06d446b3adb9609f8cd5d14505b8cce9d9af608f44395ea6665ff6e8579facf22f7ceb6fbb3f5ec30a290dbdc8844efe75d
@@ -161,12 +161,13 @@ module Switchman
161
161
 
162
162
  def quote_local_table_name(name)
163
163
  # postgres quotes tables and columns the same; just pass through
164
- # (differs from quote_table_name below by no logic to explicitly
165
- # qualify the table)
164
+ # (differs from quote_table_name_with_shard below by no logic to
165
+ # explicitly qualify the table)
166
166
  quote_column_name(name)
167
167
  end
168
168
 
169
- def quote_table_name name
169
+ def quote_table_name(name)
170
+ return quote_local_table_name(name) if @use_local_table_name
170
171
  name = ::ActiveRecord::ConnectionAdapters::PostgreSQL::Utils.extract_schema_qualified_name(name.to_s)
171
172
  if !name.schema && use_qualified_names?
172
173
  name.instance_variable_set(:@schema, shard.name)
@@ -174,6 +175,13 @@ module Switchman
174
175
  name.quoted
175
176
  end
176
177
 
178
+ def with_local_table_name
179
+ @use_local_table_name = true
180
+ yield
181
+ ensure
182
+ @use_local_table_name = false
183
+ end
184
+
177
185
  def foreign_keys(table_name)
178
186
  schema = shard.name if use_qualified_names?
179
187
 
@@ -224,19 +224,7 @@ module Switchman
224
224
  end
225
225
 
226
226
  def arel_columns(columns)
227
- columns.flat_map do |field|
228
- if (Symbol === field || String === field) && (klass.has_attribute?(field) || klass.attribute_alias?(field)) && !from_clause.value
229
- klass.arel_attribute(field, table)
230
- elsif Symbol === field
231
- # the rest of this is pulled from AR - the only change is from quote_table_name to quote_column_name here
232
- # otherwise qualified names will add the schema to a column
233
- connection.quote_column_name(field.to_s)
234
- elsif Proc === field
235
- field.call
236
- else
237
- field
238
- end
239
- end
227
+ connection.with_local_table_name { super }
240
228
  end
241
229
 
242
230
  # semi-private
@@ -1,3 +1,3 @@
1
1
  module Switchman
2
- VERSION = "1.13.2"
2
+ VERSION = "1.13.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: switchman
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.2
4
+ version: 1.13.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Cutrer
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-04-23 00:00:00.000000000 Z
13
+ date: 2019-05-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: railties