ransack 2.3.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +3 -0
  3. data/.github/SECURITY.md +12 -0
  4. data/.github/workflows/codeql.yml +72 -0
  5. data/.github/workflows/cronjob.yml +102 -0
  6. data/.github/workflows/deploy.yml +35 -0
  7. data/.github/workflows/rubocop.yml +20 -0
  8. data/.github/workflows/test-deploy.yml +29 -0
  9. data/.github/workflows/test.yml +128 -0
  10. data/.nojekyll +0 -0
  11. data/.rubocop.yml +47 -0
  12. data/CHANGELOG.md +228 -1
  13. data/CONTRIBUTING.md +47 -22
  14. data/Gemfile +24 -10
  15. data/README.md +49 -917
  16. data/bug_report_templates/test-ransack-scope-and-column-same-name.rb +78 -0
  17. data/bug_report_templates/test-ransacker-arel-present-predicate.rb +75 -0
  18. data/docs/.gitignore +19 -0
  19. data/docs/.nojekyll +0 -0
  20. data/docs/babel.config.js +3 -0
  21. data/docs/blog/2022-03-27-ransack-3.0.0.md +20 -0
  22. data/docs/docs/getting-started/_category_.json +4 -0
  23. data/docs/docs/getting-started/advanced-mode.md +46 -0
  24. data/docs/docs/getting-started/configuration.md +47 -0
  25. data/docs/docs/getting-started/search-matches.md +67 -0
  26. data/docs/docs/getting-started/simple-mode.md +288 -0
  27. data/docs/docs/getting-started/sorting.md +79 -0
  28. data/docs/docs/getting-started/using-predicates.md +282 -0
  29. data/docs/docs/going-further/_category_.json +4 -0
  30. data/docs/docs/going-further/acts-as-taggable-on.md +114 -0
  31. data/docs/docs/going-further/associations.md +70 -0
  32. data/docs/docs/going-further/custom-predicates.md +52 -0
  33. data/docs/docs/going-further/documentation.md +43 -0
  34. data/docs/docs/going-further/exporting-to-csv.md +49 -0
  35. data/docs/docs/going-further/external-guides.md +57 -0
  36. data/docs/docs/going-further/form-customisation.md +63 -0
  37. data/docs/docs/going-further/i18n.md +53 -0
  38. data/docs/docs/going-further/img/create_release.png +0 -0
  39. data/docs/docs/going-further/merging-searches.md +41 -0
  40. data/docs/docs/going-further/other-notes.md +428 -0
  41. data/docs/docs/going-further/polymorphic-search.md +40 -0
  42. data/docs/docs/going-further/ransackers.md +331 -0
  43. data/docs/docs/going-further/release_process.md +36 -0
  44. data/docs/docs/going-further/saving-queries.md +82 -0
  45. data/docs/docs/going-further/searching-postgres.md +57 -0
  46. data/docs/docs/going-further/wiki-contributors.md +82 -0
  47. data/docs/docs/intro.md +99 -0
  48. data/docs/docusaurus.config.js +120 -0
  49. data/docs/package.json +42 -0
  50. data/docs/sidebars.js +31 -0
  51. data/docs/src/components/HomepageFeatures/index.js +64 -0
  52. data/docs/src/components/HomepageFeatures/styles.module.css +11 -0
  53. data/docs/src/css/custom.css +39 -0
  54. data/docs/src/pages/index.module.css +23 -0
  55. data/docs/src/pages/markdown-page.md +7 -0
  56. data/docs/static/.nojekyll +0 -0
  57. data/docs/static/img/docusaurus.png +0 -0
  58. data/docs/static/img/favicon.ico +0 -0
  59. data/docs/static/img/logo.svg +1 -0
  60. data/docs/static/img/tutorial/docsVersionDropdown.png +0 -0
  61. data/docs/static/img/tutorial/localeDropdown.png +0 -0
  62. data/docs/static/img/undraw_docusaurus_mountain.svg +171 -0
  63. data/docs/static/img/undraw_docusaurus_react.svg +170 -0
  64. data/docs/static/img/undraw_docusaurus_tree.svg +40 -0
  65. data/docs/yarn.lock +8790 -0
  66. data/lib/polyamorous/activerecord_6.1_ruby_2/join_association.rb +70 -0
  67. data/{polyamorous/lib/polyamorous/activerecord_6.0_ruby_2 → lib/polyamorous/activerecord_6.1_ruby_2}/join_dependency.rb +23 -12
  68. data/lib/polyamorous/activerecord_6.1_ruby_2/reflection.rb +11 -0
  69. data/lib/polyamorous/activerecord_7.0_ruby_2/join_association.rb +1 -0
  70. data/lib/polyamorous/activerecord_7.0_ruby_2/join_dependency.rb +1 -0
  71. data/lib/polyamorous/activerecord_7.0_ruby_2/reflection.rb +1 -0
  72. data/lib/polyamorous/activerecord_7.1_ruby_2/join_association.rb +1 -0
  73. data/lib/polyamorous/activerecord_7.1_ruby_2/join_dependency.rb +1 -0
  74. data/lib/polyamorous/activerecord_7.1_ruby_2/reflection.rb +1 -0
  75. data/{polyamorous/lib → lib/polyamorous}/polyamorous.rb +3 -8
  76. data/lib/ransack/adapters/active_record/base.rb +83 -10
  77. data/lib/ransack/adapters/active_record/context.rb +59 -115
  78. data/lib/ransack/configuration.rb +53 -10
  79. data/lib/ransack/constants.rb +126 -7
  80. data/lib/ransack/context.rb +34 -5
  81. data/lib/ransack/helpers/form_builder.rb +11 -17
  82. data/lib/ransack/helpers/form_helper.rb +14 -5
  83. data/lib/ransack/helpers.rb +1 -1
  84. data/lib/ransack/locale/sk.yml +70 -0
  85. data/lib/ransack/locale/sv.yml +70 -0
  86. data/lib/ransack/nodes/attribute.rb +3 -3
  87. data/lib/ransack/nodes/condition.rb +87 -8
  88. data/lib/ransack/nodes/grouping.rb +4 -4
  89. data/lib/ransack/nodes/node.rb +1 -1
  90. data/lib/ransack/nodes/sort.rb +3 -3
  91. data/lib/ransack/nodes/value.rb +3 -3
  92. data/lib/ransack/predicate.rb +3 -2
  93. data/lib/ransack/ransacker.rb +1 -1
  94. data/lib/ransack/search.rb +15 -7
  95. data/lib/ransack/translate.rb +6 -6
  96. data/lib/ransack/version.rb +1 -1
  97. data/lib/ransack/visitor.rb +38 -2
  98. data/lib/ransack.rb +6 -10
  99. data/ransack.gemspec +9 -24
  100. data/spec/blueprints/articles.rb +1 -1
  101. data/spec/blueprints/comments.rb +1 -1
  102. data/spec/blueprints/notes.rb +1 -1
  103. data/spec/blueprints/tags.rb +1 -1
  104. data/spec/console.rb +5 -5
  105. data/spec/helpers/polyamorous_helper.rb +2 -17
  106. data/spec/helpers/ransack_helper.rb +1 -1
  107. data/spec/polyamorous/activerecord_compatibility_spec.rb +15 -0
  108. data/spec/{ransack → polyamorous}/join_association_spec.rb +3 -1
  109. data/spec/{ransack → polyamorous}/join_dependency_spec.rb +0 -16
  110. data/spec/ransack/adapters/active_record/base_spec.rb +109 -16
  111. data/spec/ransack/adapters/active_record/context_spec.rb +19 -18
  112. data/spec/ransack/configuration_spec.rb +33 -9
  113. data/spec/ransack/helpers/form_builder_spec.rb +8 -8
  114. data/spec/ransack/helpers/form_helper_spec.rb +109 -20
  115. data/spec/ransack/nodes/condition_spec.rb +37 -0
  116. data/spec/ransack/nodes/grouping_spec.rb +2 -2
  117. data/spec/ransack/nodes/value_spec.rb +115 -0
  118. data/spec/ransack/predicate_spec.rb +75 -2
  119. data/spec/ransack/search_spec.rb +239 -38
  120. data/spec/ransack/translate_spec.rb +1 -1
  121. data/spec/spec_helper.rb +9 -5
  122. data/spec/support/schema.rb +83 -12
  123. metadata +105 -195
  124. data/.travis.yml +0 -49
  125. data/lib/ransack/adapters/active_record/ransack/constants.rb +0 -116
  126. data/lib/ransack/adapters/active_record/ransack/context.rb +0 -60
  127. data/lib/ransack/adapters/active_record/ransack/nodes/condition.rb +0 -61
  128. data/lib/ransack/adapters/active_record/ransack/translate.rb +0 -8
  129. data/lib/ransack/adapters/active_record/ransack/visitor.rb +0 -47
  130. data/lib/ransack/adapters.rb +0 -64
  131. data/lib/ransack/nodes.rb +0 -8
  132. data/polyamorous/lib/polyamorous/activerecord_5.0_ruby_2/join_association.rb +0 -2
  133. data/polyamorous/lib/polyamorous/activerecord_5.0_ruby_2/join_dependency.rb +0 -2
  134. data/polyamorous/lib/polyamorous/activerecord_5.1_ruby_2/join_association.rb +0 -31
  135. data/polyamorous/lib/polyamorous/activerecord_5.1_ruby_2/join_dependency.rb +0 -112
  136. data/polyamorous/lib/polyamorous/activerecord_5.2.0_ruby_2/join_association.rb +0 -31
  137. data/polyamorous/lib/polyamorous/activerecord_5.2.0_ruby_2/join_dependency.rb +0 -112
  138. data/polyamorous/lib/polyamorous/activerecord_5.2.0_ruby_2/reflection.rb +0 -12
  139. data/polyamorous/lib/polyamorous/activerecord_5.2.1_ruby_2/join_association.rb +0 -22
  140. data/polyamorous/lib/polyamorous/activerecord_5.2.1_ruby_2/join_dependency.rb +0 -81
  141. data/polyamorous/lib/polyamorous/activerecord_5.2.1_ruby_2/reflection.rb +0 -2
  142. data/polyamorous/lib/polyamorous/activerecord_6.0_ruby_2/join_association.rb +0 -2
  143. data/polyamorous/lib/polyamorous/activerecord_6.0_ruby_2/reflection.rb +0 -2
  144. data/polyamorous/lib/polyamorous/activerecord_6.1_ruby_2/join_association.rb +0 -2
  145. data/polyamorous/lib/polyamorous/activerecord_6.1_ruby_2/join_dependency.rb +0 -2
  146. data/polyamorous/lib/polyamorous/activerecord_6.1_ruby_2/reflection.rb +0 -2
  147. data/polyamorous/lib/polyamorous/version.rb +0 -3
  148. data/polyamorous/polyamorous.gemspec +0 -35
  149. /data/{logo → docs/static/logo}/ransack-h.png +0 -0
  150. /data/{logo → docs/static/logo}/ransack-h.svg +0 -0
  151. /data/{logo → docs/static/logo}/ransack-v.png +0 -0
  152. /data/{logo → docs/static/logo}/ransack-v.svg +0 -0
  153. /data/{logo → docs/static/logo}/ransack.png +0 -0
  154. /data/{logo → docs/static/logo}/ransack.svg +0 -0
  155. /data/{polyamorous/lib → lib}/polyamorous/join.rb +0 -0
  156. /data/{polyamorous/lib → lib}/polyamorous/swapping_reflection_class.rb +0 -0
  157. /data/{polyamorous/lib → lib}/polyamorous/tree_node.rb +0 -0
  158. /data/lib/ransack/{adapters/active_record.rb → active_record.rb} +0 -0
  159. /data/spec/{ransack → polyamorous}/join_spec.rb +0 -0
metadata CHANGED
@@ -1,60 +1,47 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ransack
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ernie Miller
8
8
  - Ryan Bigg
9
9
  - Jon Atack
10
10
  - Sean Carroll
11
- autorequire:
11
+ - David Rodríguez
12
+ autorequire:
12
13
  bindir: bin
13
14
  cert_chain: []
14
- date: 2019-08-18 00:00:00.000000000 Z
15
+ date: 2023-02-09 00:00:00.000000000 Z
15
16
  dependencies:
16
- - !ruby/object:Gem::Dependency
17
- name: actionpack
18
- requirement: !ruby/object:Gem::Requirement
19
- requirements:
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: '5.0'
23
- type: :runtime
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: '5.0'
30
17
  - !ruby/object:Gem::Dependency
31
18
  name: activerecord
32
19
  requirement: !ruby/object:Gem::Requirement
33
20
  requirements:
34
21
  - - ">="
35
22
  - !ruby/object:Gem::Version
36
- version: '5.0'
23
+ version: 6.1.5
37
24
  type: :runtime
38
25
  prerelease: false
39
26
  version_requirements: !ruby/object:Gem::Requirement
40
27
  requirements:
41
28
  - - ">="
42
29
  - !ruby/object:Gem::Version
43
- version: '5.0'
30
+ version: 6.1.5
44
31
  - !ruby/object:Gem::Dependency
45
32
  name: activesupport
46
33
  requirement: !ruby/object:Gem::Requirement
47
34
  requirements:
48
35
  - - ">="
49
36
  - !ruby/object:Gem::Version
50
- version: '5.0'
37
+ version: 6.1.5
51
38
  type: :runtime
52
39
  prerelease: false
53
40
  version_requirements: !ruby/object:Gem::Requirement
54
41
  requirements:
55
42
  - - ">="
56
43
  - !ruby/object:Gem::Version
57
- version: '5.0'
44
+ version: 6.1.5
58
45
  - !ruby/object:Gem::Dependency
59
46
  name: i18n
60
47
  requirement: !ruby/object:Gem::Requirement
@@ -69,132 +56,6 @@ dependencies:
69
56
  - - ">="
70
57
  - !ruby/object:Gem::Version
71
58
  version: '0'
72
- - !ruby/object:Gem::Dependency
73
- name: polyamorous
74
- requirement: !ruby/object:Gem::Requirement
75
- requirements:
76
- - - '='
77
- - !ruby/object:Gem::Version
78
- version: 2.3.0
79
- type: :runtime
80
- prerelease: false
81
- version_requirements: !ruby/object:Gem::Requirement
82
- requirements:
83
- - - '='
84
- - !ruby/object:Gem::Version
85
- version: 2.3.0
86
- - !ruby/object:Gem::Dependency
87
- name: rspec
88
- requirement: !ruby/object:Gem::Requirement
89
- requirements:
90
- - - "~>"
91
- - !ruby/object:Gem::Version
92
- version: '3'
93
- type: :development
94
- prerelease: false
95
- version_requirements: !ruby/object:Gem::Requirement
96
- requirements:
97
- - - "~>"
98
- - !ruby/object:Gem::Version
99
- version: '3'
100
- - !ruby/object:Gem::Dependency
101
- name: machinist
102
- requirement: !ruby/object:Gem::Requirement
103
- requirements:
104
- - - "~>"
105
- - !ruby/object:Gem::Version
106
- version: 1.0.6
107
- type: :development
108
- prerelease: false
109
- version_requirements: !ruby/object:Gem::Requirement
110
- requirements:
111
- - - "~>"
112
- - !ruby/object:Gem::Version
113
- version: 1.0.6
114
- - !ruby/object:Gem::Dependency
115
- name: faker
116
- requirement: !ruby/object:Gem::Requirement
117
- requirements:
118
- - - "~>"
119
- - !ruby/object:Gem::Version
120
- version: 0.9.5
121
- type: :development
122
- prerelease: false
123
- version_requirements: !ruby/object:Gem::Requirement
124
- requirements:
125
- - - "~>"
126
- - !ruby/object:Gem::Version
127
- version: 0.9.5
128
- - !ruby/object:Gem::Dependency
129
- name: sqlite3
130
- requirement: !ruby/object:Gem::Requirement
131
- requirements:
132
- - - "~>"
133
- - !ruby/object:Gem::Version
134
- version: 1.4.1
135
- type: :development
136
- prerelease: false
137
- version_requirements: !ruby/object:Gem::Requirement
138
- requirements:
139
- - - "~>"
140
- - !ruby/object:Gem::Version
141
- version: 1.4.1
142
- - !ruby/object:Gem::Dependency
143
- name: pg
144
- requirement: !ruby/object:Gem::Requirement
145
- requirements:
146
- - - "~>"
147
- - !ruby/object:Gem::Version
148
- version: '0.21'
149
- type: :development
150
- prerelease: false
151
- version_requirements: !ruby/object:Gem::Requirement
152
- requirements:
153
- - - "~>"
154
- - !ruby/object:Gem::Version
155
- version: '0.21'
156
- - !ruby/object:Gem::Dependency
157
- name: mysql2
158
- requirement: !ruby/object:Gem::Requirement
159
- requirements:
160
- - - '='
161
- - !ruby/object:Gem::Version
162
- version: 0.3.20
163
- type: :development
164
- prerelease: false
165
- version_requirements: !ruby/object:Gem::Requirement
166
- requirements:
167
- - - '='
168
- - !ruby/object:Gem::Version
169
- version: 0.3.20
170
- - !ruby/object:Gem::Dependency
171
- name: pry
172
- requirement: !ruby/object:Gem::Requirement
173
- requirements:
174
- - - '='
175
- - !ruby/object:Gem::Version
176
- version: '0.10'
177
- type: :development
178
- prerelease: false
179
- version_requirements: !ruby/object:Gem::Requirement
180
- requirements:
181
- - - '='
182
- - !ruby/object:Gem::Version
183
- version: '0.10'
184
- - !ruby/object:Gem::Dependency
185
- name: byebug
186
- requirement: !ruby/object:Gem::Requirement
187
- requirements:
188
- - - ">="
189
- - !ruby/object:Gem::Version
190
- version: '0'
191
- type: :development
192
- prerelease: false
193
- version_requirements: !ruby/object:Gem::Requirement
194
- requirements:
195
- - - ">="
196
- - !ruby/object:Gem::Version
197
- version: '0'
198
59
  description: Ransack is the successor to the MetaSearch gem. It improves and expands
199
60
  upon MetaSearch's functionality, but does not have a 100%-compatible API.
200
61
  email:
@@ -206,24 +67,96 @@ executables: []
206
67
  extensions: []
207
68
  extra_rdoc_files: []
208
69
  files:
70
+ - ".github/FUNDING.yml"
71
+ - ".github/SECURITY.md"
72
+ - ".github/workflows/codeql.yml"
73
+ - ".github/workflows/cronjob.yml"
74
+ - ".github/workflows/deploy.yml"
75
+ - ".github/workflows/rubocop.yml"
76
+ - ".github/workflows/test-deploy.yml"
77
+ - ".github/workflows/test.yml"
209
78
  - ".gitignore"
210
- - ".travis.yml"
79
+ - ".nojekyll"
80
+ - ".rubocop.yml"
211
81
  - CHANGELOG.md
212
82
  - CONTRIBUTING.md
213
83
  - Gemfile
214
84
  - LICENSE
215
85
  - README.md
216
86
  - Rakefile
87
+ - bug_report_templates/test-ransack-scope-and-column-same-name.rb
88
+ - bug_report_templates/test-ransacker-arel-present-predicate.rb
89
+ - docs/.gitignore
90
+ - docs/.nojekyll
91
+ - docs/babel.config.js
92
+ - docs/blog/2022-03-27-ransack-3.0.0.md
93
+ - docs/docs/getting-started/_category_.json
94
+ - docs/docs/getting-started/advanced-mode.md
95
+ - docs/docs/getting-started/configuration.md
96
+ - docs/docs/getting-started/search-matches.md
97
+ - docs/docs/getting-started/simple-mode.md
98
+ - docs/docs/getting-started/sorting.md
99
+ - docs/docs/getting-started/using-predicates.md
100
+ - docs/docs/going-further/_category_.json
101
+ - docs/docs/going-further/acts-as-taggable-on.md
102
+ - docs/docs/going-further/associations.md
103
+ - docs/docs/going-further/custom-predicates.md
104
+ - docs/docs/going-further/documentation.md
105
+ - docs/docs/going-further/exporting-to-csv.md
106
+ - docs/docs/going-further/external-guides.md
107
+ - docs/docs/going-further/form-customisation.md
108
+ - docs/docs/going-further/i18n.md
109
+ - docs/docs/going-further/img/create_release.png
110
+ - docs/docs/going-further/merging-searches.md
111
+ - docs/docs/going-further/other-notes.md
112
+ - docs/docs/going-further/polymorphic-search.md
113
+ - docs/docs/going-further/ransackers.md
114
+ - docs/docs/going-further/release_process.md
115
+ - docs/docs/going-further/saving-queries.md
116
+ - docs/docs/going-further/searching-postgres.md
117
+ - docs/docs/going-further/wiki-contributors.md
118
+ - docs/docs/intro.md
119
+ - docs/docusaurus.config.js
120
+ - docs/package.json
121
+ - docs/sidebars.js
122
+ - docs/src/components/HomepageFeatures/index.js
123
+ - docs/src/components/HomepageFeatures/styles.module.css
124
+ - docs/src/css/custom.css
125
+ - docs/src/pages/index.module.css
126
+ - docs/src/pages/markdown-page.md
127
+ - docs/static/.nojekyll
128
+ - docs/static/img/docusaurus.png
129
+ - docs/static/img/favicon.ico
130
+ - docs/static/img/logo.svg
131
+ - docs/static/img/tutorial/docsVersionDropdown.png
132
+ - docs/static/img/tutorial/localeDropdown.png
133
+ - docs/static/img/undraw_docusaurus_mountain.svg
134
+ - docs/static/img/undraw_docusaurus_react.svg
135
+ - docs/static/img/undraw_docusaurus_tree.svg
136
+ - docs/static/logo/ransack-h.png
137
+ - docs/static/logo/ransack-h.svg
138
+ - docs/static/logo/ransack-v.png
139
+ - docs/static/logo/ransack-v.svg
140
+ - docs/static/logo/ransack.png
141
+ - docs/static/logo/ransack.svg
142
+ - docs/yarn.lock
143
+ - lib/polyamorous/activerecord_6.1_ruby_2/join_association.rb
144
+ - lib/polyamorous/activerecord_6.1_ruby_2/join_dependency.rb
145
+ - lib/polyamorous/activerecord_6.1_ruby_2/reflection.rb
146
+ - lib/polyamorous/activerecord_7.0_ruby_2/join_association.rb
147
+ - lib/polyamorous/activerecord_7.0_ruby_2/join_dependency.rb
148
+ - lib/polyamorous/activerecord_7.0_ruby_2/reflection.rb
149
+ - lib/polyamorous/activerecord_7.1_ruby_2/join_association.rb
150
+ - lib/polyamorous/activerecord_7.1_ruby_2/join_dependency.rb
151
+ - lib/polyamorous/activerecord_7.1_ruby_2/reflection.rb
152
+ - lib/polyamorous/join.rb
153
+ - lib/polyamorous/polyamorous.rb
154
+ - lib/polyamorous/swapping_reflection_class.rb
155
+ - lib/polyamorous/tree_node.rb
217
156
  - lib/ransack.rb
218
- - lib/ransack/adapters.rb
219
- - lib/ransack/adapters/active_record.rb
157
+ - lib/ransack/active_record.rb
220
158
  - lib/ransack/adapters/active_record/base.rb
221
159
  - lib/ransack/adapters/active_record/context.rb
222
- - lib/ransack/adapters/active_record/ransack/constants.rb
223
- - lib/ransack/adapters/active_record/ransack/context.rb
224
- - lib/ransack/adapters/active_record/ransack/nodes/condition.rb
225
- - lib/ransack/adapters/active_record/ransack/translate.rb
226
- - lib/ransack/adapters/active_record/ransack/visitor.rb
227
160
  - lib/ransack/configuration.rb
228
161
  - lib/ransack/constants.rb
229
162
  - lib/ransack/context.rb
@@ -251,11 +184,12 @@ files:
251
184
  - lib/ransack/locale/pt-BR.yml
252
185
  - lib/ransack/locale/ro.yml
253
186
  - lib/ransack/locale/ru.yml
187
+ - lib/ransack/locale/sk.yml
188
+ - lib/ransack/locale/sv.yml
254
189
  - lib/ransack/locale/tr.yml
255
190
  - lib/ransack/locale/zh-CN.yml
256
191
  - lib/ransack/locale/zh-TW.yml
257
192
  - lib/ransack/naming.rb
258
- - lib/ransack/nodes.rb
259
193
  - lib/ransack/nodes/attribute.rb
260
194
  - lib/ransack/nodes/bindable.rb
261
195
  - lib/ransack/nodes/condition.rb
@@ -269,34 +203,6 @@ files:
269
203
  - lib/ransack/translate.rb
270
204
  - lib/ransack/version.rb
271
205
  - lib/ransack/visitor.rb
272
- - logo/ransack-h.png
273
- - logo/ransack-h.svg
274
- - logo/ransack-v.png
275
- - logo/ransack-v.svg
276
- - logo/ransack.png
277
- - logo/ransack.svg
278
- - polyamorous/lib/polyamorous.rb
279
- - polyamorous/lib/polyamorous/activerecord_5.0_ruby_2/join_association.rb
280
- - polyamorous/lib/polyamorous/activerecord_5.0_ruby_2/join_dependency.rb
281
- - polyamorous/lib/polyamorous/activerecord_5.1_ruby_2/join_association.rb
282
- - polyamorous/lib/polyamorous/activerecord_5.1_ruby_2/join_dependency.rb
283
- - polyamorous/lib/polyamorous/activerecord_5.2.0_ruby_2/join_association.rb
284
- - polyamorous/lib/polyamorous/activerecord_5.2.0_ruby_2/join_dependency.rb
285
- - polyamorous/lib/polyamorous/activerecord_5.2.0_ruby_2/reflection.rb
286
- - polyamorous/lib/polyamorous/activerecord_5.2.1_ruby_2/join_association.rb
287
- - polyamorous/lib/polyamorous/activerecord_5.2.1_ruby_2/join_dependency.rb
288
- - polyamorous/lib/polyamorous/activerecord_5.2.1_ruby_2/reflection.rb
289
- - polyamorous/lib/polyamorous/activerecord_6.0_ruby_2/join_association.rb
290
- - polyamorous/lib/polyamorous/activerecord_6.0_ruby_2/join_dependency.rb
291
- - polyamorous/lib/polyamorous/activerecord_6.0_ruby_2/reflection.rb
292
- - polyamorous/lib/polyamorous/activerecord_6.1_ruby_2/join_association.rb
293
- - polyamorous/lib/polyamorous/activerecord_6.1_ruby_2/join_dependency.rb
294
- - polyamorous/lib/polyamorous/activerecord_6.1_ruby_2/reflection.rb
295
- - polyamorous/lib/polyamorous/join.rb
296
- - polyamorous/lib/polyamorous/swapping_reflection_class.rb
297
- - polyamorous/lib/polyamorous/tree_node.rb
298
- - polyamorous/lib/polyamorous/version.rb
299
- - polyamorous/polyamorous.gemspec
300
206
  - ransack.gemspec
301
207
  - spec/blueprints/articles.rb
302
208
  - spec/blueprints/comments.rb
@@ -306,16 +212,18 @@ files:
306
212
  - spec/console.rb
307
213
  - spec/helpers/polyamorous_helper.rb
308
214
  - spec/helpers/ransack_helper.rb
215
+ - spec/polyamorous/activerecord_compatibility_spec.rb
216
+ - spec/polyamorous/join_association_spec.rb
217
+ - spec/polyamorous/join_dependency_spec.rb
218
+ - spec/polyamorous/join_spec.rb
309
219
  - spec/ransack/adapters/active_record/base_spec.rb
310
220
  - spec/ransack/adapters/active_record/context_spec.rb
311
221
  - spec/ransack/configuration_spec.rb
312
222
  - spec/ransack/helpers/form_builder_spec.rb
313
223
  - spec/ransack/helpers/form_helper_spec.rb
314
- - spec/ransack/join_association_spec.rb
315
- - spec/ransack/join_dependency_spec.rb
316
- - spec/ransack/join_spec.rb
317
224
  - spec/ransack/nodes/condition_spec.rb
318
225
  - spec/ransack/nodes/grouping_spec.rb
226
+ - spec/ransack/nodes/value_spec.rb
319
227
  - spec/ransack/predicate_spec.rb
320
228
  - spec/ransack/search_spec.rb
321
229
  - spec/ransack/translate_spec.rb
@@ -326,7 +234,7 @@ homepage: https://github.com/activerecord-hackery/ransack
326
234
  licenses:
327
235
  - MIT
328
236
  metadata: {}
329
- post_install_message:
237
+ post_install_message:
330
238
  rdoc_options: []
331
239
  require_paths:
332
240
  - lib
@@ -334,17 +242,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
334
242
  requirements:
335
243
  - - ">="
336
244
  - !ruby/object:Gem::Version
337
- version: '1.9'
245
+ version: '2.7'
338
246
  required_rubygems_version: !ruby/object:Gem::Requirement
339
247
  requirements:
340
248
  - - ">="
341
249
  - !ruby/object:Gem::Version
342
250
  version: '0'
343
251
  requirements: []
344
- rubygems_version: 3.0.2
345
- signing_key:
252
+ rubygems_version: 3.4.6
253
+ signing_key:
346
254
  specification_version: 4
347
- summary: Object-based searching for Active Record and Mongoid (currently).
255
+ summary: Object-based searching for Active Record.
348
256
  test_files:
349
257
  - spec/blueprints/articles.rb
350
258
  - spec/blueprints/comments.rb
@@ -354,16 +262,18 @@ test_files:
354
262
  - spec/console.rb
355
263
  - spec/helpers/polyamorous_helper.rb
356
264
  - spec/helpers/ransack_helper.rb
265
+ - spec/polyamorous/activerecord_compatibility_spec.rb
266
+ - spec/polyamorous/join_association_spec.rb
267
+ - spec/polyamorous/join_dependency_spec.rb
268
+ - spec/polyamorous/join_spec.rb
357
269
  - spec/ransack/adapters/active_record/base_spec.rb
358
270
  - spec/ransack/adapters/active_record/context_spec.rb
359
271
  - spec/ransack/configuration_spec.rb
360
272
  - spec/ransack/helpers/form_builder_spec.rb
361
273
  - spec/ransack/helpers/form_helper_spec.rb
362
- - spec/ransack/join_association_spec.rb
363
- - spec/ransack/join_dependency_spec.rb
364
- - spec/ransack/join_spec.rb
365
274
  - spec/ransack/nodes/condition_spec.rb
366
275
  - spec/ransack/nodes/grouping_spec.rb
276
+ - spec/ransack/nodes/value_spec.rb
367
277
  - spec/ransack/predicate_spec.rb
368
278
  - spec/ransack/search_spec.rb
369
279
  - spec/ransack/translate_spec.rb
data/.travis.yml DELETED
@@ -1,49 +0,0 @@
1
- language: ruby
2
-
3
- sudo: false
4
-
5
- rvm:
6
- - 2.6.0
7
-
8
- services:
9
- - mysql
10
-
11
- env:
12
- - RAILS=6-0-stable DB=sqlite3
13
- - RAILS=6-0-stable DB=mysql
14
- - RAILS=6-0-stable DB=postgres
15
-
16
- - RAILS=v6.0.0 DB=sqlite3
17
- - RAILS=v6.0.0 DB=mysql
18
- - RAILS=v6.0.0 DB=postgres
19
-
20
- - RAILS=5-2-stable DB=sqlite3
21
- - RAILS=5-2-stable DB=mysql
22
- - RAILS=5-2-stable DB=postgres
23
-
24
- - RAILS=v5.2.1 DB=sqlite3
25
- - RAILS=v5.2.1 DB=mysql
26
- - RAILS=v5.2.1 DB=postgres
27
-
28
- - RAILS=v5.2.0 DB=sqlite3
29
- - RAILS=v5.2.0 DB=mysql
30
- - RAILS=v5.2.0 DB=postgres
31
-
32
- - RAILS=5-1-stable DB=sqlite3
33
- - RAILS=5-1-stable DB=mysql
34
- - RAILS=5-1-stable DB=postgres
35
-
36
- matrix:
37
- allow_failures:
38
- - env: RAILS=5-2-stable DB=sqlite3
39
- - env: RAILS=5-2-stable DB=mysql
40
- - env: RAILS=5-2-stable DB=postgres
41
- before_script:
42
- - mysql -e 'create database ransack collate utf8_general_ci;'
43
- - mysql -e 'use ransack;show variables like "%character%";show variables like "%collation%";'
44
- - psql -c 'create database ransack;' -U postgres
45
-
46
- addons:
47
- code_climate:
48
- repo_token: 8b701c4364d51a0217105e08c06922d600cec3d9e60d546a89e3ddfe46e0664e
49
- postgresql: "9.6"
@@ -1,116 +0,0 @@
1
- module Ransack
2
- module Constants
3
- DISTINCT = 'DISTINCT '.freeze
4
-
5
- DERIVED_PREDICATES = [
6
- [CONT, {
7
- arel_predicate: 'matches'.freeze,
8
- formatter: proc { |v| "%#{escape_wildcards(v)}%" }
9
- }
10
- ],
11
- ['not_cont'.freeze, {
12
- arel_predicate: 'does_not_match'.freeze,
13
- formatter: proc { |v| "%#{escape_wildcards(v)}%" }
14
- }
15
- ],
16
- ['start'.freeze, {
17
- arel_predicate: 'matches'.freeze,
18
- formatter: proc { |v| "#{escape_wildcards(v)}%" }
19
- }
20
- ],
21
- ['not_start'.freeze, {
22
- arel_predicate: 'does_not_match'.freeze,
23
- formatter: proc { |v| "#{escape_wildcards(v)}%" }
24
- }
25
- ],
26
- ['end'.freeze, {
27
- arel_predicate: 'matches'.freeze,
28
- formatter: proc { |v| "%#{escape_wildcards(v)}" }
29
- }
30
- ],
31
- ['not_end'.freeze, {
32
- arel_predicate: 'does_not_match'.freeze,
33
- formatter: proc { |v| "%#{escape_wildcards(v)}" }
34
- }
35
- ],
36
- ['true'.freeze, {
37
- arel_predicate: proc { |v| v ? EQ : NOT_EQ },
38
- compounds: false,
39
- type: :boolean,
40
- validator: proc { |v| BOOLEAN_VALUES.include?(v) },
41
- formatter: proc { |v| true }
42
- }
43
- ],
44
- ['not_true'.freeze, {
45
- arel_predicate: proc { |v| v ? NOT_EQ : EQ },
46
- compounds: false,
47
- type: :boolean,
48
- validator: proc { |v| BOOLEAN_VALUES.include?(v) },
49
- formatter: proc { |v| true }
50
- }
51
- ],
52
- ['false'.freeze, {
53
- arel_predicate: proc { |v| v ? EQ : NOT_EQ },
54
- compounds: false,
55
- type: :boolean,
56
- validator: proc { |v| BOOLEAN_VALUES.include?(v) },
57
- formatter: proc { |v| false }
58
- }
59
- ],
60
- ['not_false'.freeze, {
61
- arel_predicate: proc { |v| v ? NOT_EQ : EQ },
62
- compounds: false,
63
- type: :boolean,
64
- validator: proc { |v| BOOLEAN_VALUES.include?(v) },
65
- formatter: proc { |v| false }
66
- }
67
- ],
68
- ['present'.freeze, {
69
- arel_predicate: proc { |v| v ? NOT_EQ_ALL : EQ_ANY },
70
- compounds: false,
71
- type: :boolean,
72
- validator: proc { |v| BOOLEAN_VALUES.include?(v) },
73
- formatter: proc { |v| [nil, ''.freeze].freeze }
74
- }
75
- ],
76
- ['blank'.freeze, {
77
- arel_predicate: proc { |v| v ? EQ_ANY : NOT_EQ_ALL },
78
- compounds: false,
79
- type: :boolean,
80
- validator: proc { |v| BOOLEAN_VALUES.include?(v) },
81
- formatter: proc { |v| [nil, ''.freeze].freeze }
82
- }
83
- ],
84
- ['null'.freeze, {
85
- arel_predicate: proc { |v| v ? EQ : NOT_EQ },
86
- compounds: false,
87
- type: :boolean,
88
- validator: proc { |v| BOOLEAN_VALUES.include?(v)},
89
- formatter: proc { |v| nil }
90
- }
91
- ],
92
- ['not_null'.freeze, {
93
- arel_predicate: proc { |v| v ? NOT_EQ : EQ },
94
- compounds: false,
95
- type: :boolean,
96
- validator: proc { |v| BOOLEAN_VALUES.include?(v) },
97
- formatter: proc { |v| nil } }
98
- ]
99
- ].freeze
100
-
101
- module_function
102
- # replace % \ to \% \\
103
- def escape_wildcards(unescaped)
104
- case ActiveRecord::Base.connection.adapter_name
105
- when "Mysql2".freeze
106
- # Necessary for MySQL
107
- unescaped.to_s.gsub(/([\\%_])/, '\\\\\\1')
108
- when "PostgreSQL".freeze
109
- # Necessary for PostgreSQL
110
- unescaped.to_s.gsub(/([\\%_.])/, '\\\\\\1')
111
- else
112
- unescaped
113
- end
114
- end
115
- end
116
- end
@@ -1,60 +0,0 @@
1
- require 'ransack/visitor'
2
-
3
- module Ransack
4
- class Context
5
- attr_reader :arel_visitor
6
-
7
- class << self
8
-
9
- def for_class(klass, options = {})
10
- if klass < ActiveRecord::Base
11
- Adapters::ActiveRecord::Context.new(klass, options)
12
- end
13
- end
14
-
15
- def for_object(object, options = {})
16
- case object
17
- when ActiveRecord::Relation
18
- Adapters::ActiveRecord::Context.new(object.klass, options)
19
- end
20
- end
21
-
22
- end # << self
23
-
24
- def initialize(object, options = {})
25
- @object = relation_for(object)
26
- @klass = @object.klass
27
- @join_dependency = join_dependency(@object)
28
- @join_type = options[:join_type] || Polyamorous::OuterJoin
29
- @search_key = options[:search_key] || Ransack.options[:search_key]
30
- @associations_pot = {}
31
- @lock_associations = []
32
-
33
- if ::ActiveRecord::VERSION::STRING >= Constants::RAILS_5_2
34
- @base = @join_dependency.instance_variable_get(:@join_root)
35
- else
36
- @base = @join_dependency.join_root
37
- @engine = @base.base_klass.arel_engine
38
- end
39
- end
40
-
41
- def bind_pair_for(key)
42
- @bind_pairs ||= {}
43
-
44
- @bind_pairs[key] ||= begin
45
- parent, attr_name = get_parent_and_attribute_name(key.to_s)
46
- [parent, attr_name] if parent && attr_name
47
- end
48
- end
49
-
50
- def klassify(obj)
51
- if Class === obj && ::ActiveRecord::Base > obj
52
- obj
53
- elsif obj.respond_to? :klass
54
- obj.klass
55
- else
56
- raise ArgumentError, "Don't know how to klassify #{obj.inspect}"
57
- end
58
- end
59
- end
60
- end