rails_admin_next 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a1e669bb86719b972a161917a8f2b88747a6be2e2233ada17c3a437e6dfdeaaf
4
- data.tar.gz: 66a69ecedbd7e4fdca9991e2044bede57d842f5bc7e1d29159a2fb4ef41a361f
3
+ metadata.gz: 2bdbd212982bdb74e9a2288a5c14eba746b74b0a0ed902afbb0671cbdfd5c107
4
+ data.tar.gz: 119040f95b74f79a05571d9f099cb98668efa5921ee2a4b43668b3fb320302ec
5
5
  SHA512:
6
- metadata.gz: 85c4a2ad4d178fee59d393020db78d735c114c8b0bb41cf42f14e70017363edd78bb49e0c461db95e8098901f30bf974a2a93683f70faf3cbb935978468cd24f
7
- data.tar.gz: 0a60be77736c263a0dabea8abb46f573948b56ee672b0ca75473012feeb5a8889a3d5bac60668a3057602f7c5b51db097f9ff39171e210671a8d16ef3856db99
6
+ metadata.gz: 583c910d3d95569fb8031b30bfda1a71ae61ecc090bdd0e8289d9e0d4ea01ee7cf635e417c912d17a2a22c5d9f1bfe764d057391fb58744c21c1c22099130531
7
+ data.tar.gz: f7c7784f080f80977c21d9ae3bc02a822a1b2576aafe07f0dc063c4c7702180f425ea7905f00d8171e0a889a8842311cbff67ffd8268601eee68659b8bfdd032
@@ -182,7 +182,7 @@ module RailsAdminNext
182
182
 
183
183
  def add(field, value, operator)
184
184
  field.searchable_columns.flatten.each do |column_infos|
185
- statement, value1, value2 = StatementBuilder.new(column_infos[:column], column_infos[:type], value, operator, @scope.connection.adapter_name).to_statement
185
+ statement, value1, value2 = StatementBuilder.new(quote(column_infos[:column]), column_infos[:type], value, operator, @scope.connection.adapter_name).to_statement
186
186
  @statements << statement if statement.present?
187
187
  @values << value1 unless value1.nil?
188
188
  @values << value2 unless value2.nil?
@@ -191,6 +191,17 @@ module RailsAdminNext
191
191
  end
192
192
  end
193
193
 
194
+ # Columns arrive as bare "table.column", and a reserved-word name such as `order`
195
+ # is a syntax error unquoted. Anything else (raw SQL, already-quoted names) is
196
+ # passed through untouched.
197
+ def quote(column)
198
+ parts = column.split(".")
199
+ return column unless parts.size == 2 && parts.all?(/\A\w+\z/)
200
+
201
+ table, name = parts
202
+ "#{@scope.connection.quote_table_name(table)}.#{@scope.connection.quote_column_name(name)}"
203
+ end
204
+
194
205
  def build
195
206
  scope = @scope.where(@statements.join(" OR "), *@values)
196
207
  scope = scope.references(*@tables.uniq) if @tables.any?
@@ -7,7 +7,7 @@ module RailsAdminNext
7
7
  # the floor a local `gem build` produces.
8
8
  MAJOR = 1
9
9
  MINOR = 1
10
- PATCH = 0
10
+ PATCH = 2
11
11
  PRE = nil
12
12
 
13
13
  class << self
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_admin_next
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel López Prat
@@ -340,7 +340,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
340
340
  - !ruby/object:Gem::Version
341
341
  version: 1.8.11
342
342
  requirements: []
343
- rubygems_version: 4.0.16
343
+ rubygems_version: 4.0.20
344
344
  specification_version: 4
345
345
  summary: Admin for Rails
346
346
  test_files: []