effective_datatables 4.17.0 → 4.17.1

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: 5fa644f48b7deb7204d3d7c6486dcdc90801075f580b721a9ae14ada37b38fae
4
- data.tar.gz: 93915b2419ba86c9783e6e7dc227a7fdd131eafe43e7534c7dd862df66fd6977
3
+ metadata.gz: 2be4e45193ceaf2f5fc2f8543cde183156ec0210d844a9603977f7b456197bf4
4
+ data.tar.gz: c7b437a89b3439f79b1d596936efb1be6401d8c12a4ffb844aecf2150d59772d
5
5
  SHA512:
6
- metadata.gz: b92b2429d730b12d36d47c0ad01f0ee347d2e985a14c99d8d15c7d524ff80660762b50b84455ba4cf35e80e3ac36425d37311021227995ceec95f26310829e21
7
- data.tar.gz: 6362c1329baebcedccb025f3e1ad7eae2fb1f30475f9013cd5840e515e26bcca16fedf9df6a5f212e11528e83bb2a15a3a8834f53c180e5ca5081e94e4e0af95
6
+ metadata.gz: d8601ecaaea61c41cdb6375e0f6b6521593326596c620142a7ea5752030dc3b9957453c1c1c3b82d6de54e21d8811fb6bad64cebef629cc6f6d064d86d8aec29
7
+ data.tar.gz: 0f55d6478da0bb096d493c898dc34a606b85f7b8b4009ff35bc5a58e5bc0a34c7828fe67b81fe4b4daa69f5b9f672d85e1d14787211bc6f4cf485e921d160884
@@ -69,13 +69,19 @@ module EffectiveDatatablesPrivateHelper
69
69
 
70
70
  case opts[:as]
71
71
  when :belongs_to
72
- opts[:resource].human_name
72
+ foreign_key = opts[:resource].initialized_name.try(:foreign_key).to_s.downcase
73
+ klass_name = opts[:resource].initialized_name.try(:class_name).to_s.downcase
74
+
75
+ if foreign_key.starts_with?(klass_name)
76
+ opts[:resource].human_name
77
+ else
78
+ datatable.collection_class.human_attribute_name(name)
79
+ end
73
80
  when :has_many
74
81
  opts[:resource].human_plural_name
75
82
  else
76
83
  datatable.collection_class.human_attribute_name(name)
77
84
  end
78
-
79
85
  end
80
86
 
81
87
  def datatable_search_tag(datatable, name, opts)
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '4.17.0'.freeze
2
+ VERSION = '4.17.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_datatables
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.17.0
4
+ version: 4.17.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-20 00:00:00.000000000 Z
11
+ date: 2023-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails