has_dynamic_columns 0.3.8 → 0.3.9

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
  SHA1:
3
- metadata.gz: b0b1ecc13bba58282485955da6aeb21a51273498
4
- data.tar.gz: ebfb6b3d4ce705e8e7cc3252c5ec08481511e1a5
3
+ metadata.gz: aaf5c0ace61bd2b3a0f1a5b41307fccf18622755
4
+ data.tar.gz: 69966df3be6a085e55614cf12632173850810fd6
5
5
  SHA512:
6
- metadata.gz: db67f6150244898ad99a6ed6b92fe48a8f39e9a66b7073dfda0ec4083430f4f06cd57353f8e6dc1e1bc4ed908f15ef9b629076ab61aa3b3c41eb9bad5647880d
7
- data.tar.gz: 3f484bdd7d0d1964630f5c646607380475f74aeffd622527ee426c0ddf3db0598baf92e4ee6b45e13dfcbe0446ae84942506f5245eb69a5d4625234a34e78ba4
6
+ metadata.gz: 9d3d6c5c41464cadf77a77e0a8c1f4dd0c357039e266975b73e1a56d655dba3f89614bba2f50da462576d1d795ccf6523378ee62cb4c72aecb88bd325446c598
7
+ data.tar.gz: 4484e55679cc4c506af1b036bb3bace89e5179894c7c6cb1c3e6e577d32b4d9781119daafa413b1869b9638cf6f6beec9e8669be3ce0649f9afa7395dec247ae
@@ -58,6 +58,7 @@ module HasDynamicColumns
58
58
  # index - unique table identifier
59
59
  # joins - list of joins processed (to prevent duplicates)
60
60
  def dynamic_column_build_arel_joins(col_name, dynamic_type, scope, index, joins)
61
+ col_name = col_name.to_s
61
62
  field_scope = scope
62
63
  field_scope_id = (!field_scope.nil?) ? field_scope.id : nil
63
64
  field_scope_type = (!field_scope.nil?) ? field_scope.class.name.constantize.to_s : nil
@@ -1,3 +1,3 @@
1
1
  module HasDynamicColumns
2
- VERSION = "0.3.8"
2
+ VERSION = "0.3.9"
3
3
  end
@@ -226,6 +226,19 @@ describe ::HasDynamicColumns::ActiveRecord::QueryMethods do
226
226
  expect(result).to eq([["1", "George", "Marshall"], ["1", "Butch", "Casidy"], ["2", "Butch", "Marshall"]])
227
227
  end
228
228
 
229
+ it 'should filter and order by the same column properly and not throw ambiguous column name errors' do
230
+ result = Customer
231
+ .where
232
+ .has_dynamic_columns(
233
+ :first_name => "A"
234
+ )
235
+ .with_scope(account)
236
+ .order
237
+ .by_dynamic_columns(first_name: :desc)
238
+ .with_scope(account)
239
+ expect{ActiveRecord::Base.connection.select_all(result.to_sql)}.to_not raise_error
240
+ end
241
+
229
242
  it 'should preserve order by multiple dynamic columns' do
230
243
  table = Customer.arel_table
231
244
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_dynamic_columns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Butch Marshall
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-15 00:00:00.000000000 Z
11
+ date: 2015-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord