ransack 1.7.0 → 2.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +5 -5
  2. data/.github/FUNDING.yml +3 -0
  3. data/.github/SECURITY.md +12 -0
  4. data/.github/workflows/test.yml +120 -0
  5. data/.gitignore +3 -0
  6. data/CHANGELOG.md +463 -27
  7. data/CONTRIBUTING.md +52 -22
  8. data/Gemfile +24 -24
  9. data/README.md +453 -126
  10. data/Rakefile +6 -25
  11. data/lib/polyamorous/activerecord_5.2_ruby_2/join_association.rb +24 -0
  12. data/lib/polyamorous/activerecord_5.2_ruby_2/join_dependency.rb +79 -0
  13. data/lib/polyamorous/activerecord_5.2_ruby_2/reflection.rb +11 -0
  14. data/lib/polyamorous/activerecord_6.0_ruby_2/join_association.rb +1 -0
  15. data/lib/polyamorous/activerecord_6.0_ruby_2/join_dependency.rb +80 -0
  16. data/lib/polyamorous/activerecord_6.0_ruby_2/reflection.rb +1 -0
  17. data/lib/polyamorous/activerecord_6.1_ruby_2/join_association.rb +74 -0
  18. data/lib/polyamorous/activerecord_6.1_ruby_2/join_dependency.rb +93 -0
  19. data/lib/polyamorous/activerecord_6.1_ruby_2/reflection.rb +1 -0
  20. data/lib/polyamorous/join.rb +70 -0
  21. data/lib/polyamorous/polyamorous.rb +24 -0
  22. data/lib/polyamorous/swapping_reflection_class.rb +11 -0
  23. data/lib/polyamorous/tree_node.rb +7 -0
  24. data/lib/ransack/adapters/active_record/base.rb +27 -2
  25. data/lib/ransack/adapters/active_record/context.rb +213 -139
  26. data/lib/ransack/adapters/active_record/ransack/constants.rb +70 -55
  27. data/lib/ransack/adapters/active_record/ransack/context.rb +10 -18
  28. data/lib/ransack/adapters/active_record/ransack/nodes/condition.rb +42 -32
  29. data/lib/ransack/adapters/active_record/ransack/translate.rb +1 -5
  30. data/lib/ransack/adapters/active_record/ransack/visitor.rb +23 -0
  31. data/lib/ransack/adapters/active_record.rb +11 -10
  32. data/lib/ransack/adapters.rb +45 -23
  33. data/lib/ransack/configuration.rb +107 -4
  34. data/lib/ransack/constants.rb +13 -26
  35. data/lib/ransack/context.rb +45 -33
  36. data/lib/ransack/helpers/form_builder.rb +21 -12
  37. data/lib/ransack/helpers/form_helper.rb +75 -70
  38. data/lib/ransack/locale/ar.yml +70 -0
  39. data/lib/ransack/locale/az.yml +70 -0
  40. data/lib/ransack/locale/bg.yml +70 -0
  41. data/lib/ransack/locale/ca.yml +70 -0
  42. data/lib/ransack/locale/da.yml +70 -0
  43. data/lib/ransack/locale/el.yml +70 -0
  44. data/lib/ransack/locale/es.yml +22 -22
  45. data/lib/ransack/locale/fa.yml +70 -0
  46. data/lib/ransack/locale/fi.yml +71 -0
  47. data/lib/ransack/locale/id.yml +70 -0
  48. data/lib/ransack/locale/it.yml +70 -0
  49. data/lib/ransack/locale/ja.yml +70 -0
  50. data/lib/ransack/locale/nl.yml +4 -4
  51. data/lib/ransack/locale/pt-BR.yml +70 -0
  52. data/lib/ransack/locale/ru.yml +70 -0
  53. data/lib/ransack/locale/sk.yml +70 -0
  54. data/lib/ransack/locale/tr.yml +70 -0
  55. data/lib/ransack/locale/{zh.yml → zh-CN.yml} +13 -13
  56. data/lib/ransack/locale/zh-TW.yml +70 -0
  57. data/lib/ransack/nodes/attribute.rb +5 -2
  58. data/lib/ransack/nodes/bindable.rb +18 -6
  59. data/lib/ransack/nodes/condition.rb +85 -28
  60. data/lib/ransack/nodes/grouping.rb +17 -11
  61. data/lib/ransack/nodes/sort.rb +9 -5
  62. data/lib/ransack/nodes/value.rb +74 -68
  63. data/lib/ransack/nodes.rb +1 -1
  64. data/lib/ransack/predicate.rb +17 -20
  65. data/lib/ransack/search.rb +17 -8
  66. data/lib/ransack/translate.rb +115 -115
  67. data/lib/ransack/version.rb +1 -1
  68. data/lib/ransack/visitor.rb +1 -12
  69. data/lib/ransack.rb +9 -9
  70. data/logo/ransack-h.png +0 -0
  71. data/logo/ransack-h.svg +34 -0
  72. data/logo/ransack-v.png +0 -0
  73. data/logo/ransack-v.svg +34 -0
  74. data/logo/ransack.png +0 -0
  75. data/logo/ransack.svg +21 -0
  76. data/ransack.gemspec +7 -24
  77. data/spec/console.rb +4 -0
  78. data/spec/helpers/polyamorous_helper.rb +19 -0
  79. data/spec/polyamorous/join_association_spec.rb +35 -0
  80. data/spec/polyamorous/join_dependency_spec.rb +97 -0
  81. data/spec/polyamorous/join_spec.rb +19 -0
  82. data/spec/ransack/adapters/active_record/base_spec.rb +370 -75
  83. data/spec/ransack/adapters/active_record/context_spec.rb +72 -34
  84. data/spec/ransack/configuration_spec.rb +97 -14
  85. data/spec/ransack/helpers/form_builder_spec.rb +2 -11
  86. data/spec/ransack/helpers/form_helper_spec.rb +481 -113
  87. data/spec/ransack/nodes/condition_spec.rb +24 -0
  88. data/spec/ransack/nodes/grouping_spec.rb +56 -0
  89. data/spec/ransack/predicate_spec.rb +79 -5
  90. data/spec/ransack/search_spec.rb +207 -81
  91. data/spec/spec_helper.rb +8 -0
  92. data/spec/support/schema.rb +100 -42
  93. metadata +57 -184
  94. data/.travis.yml +0 -69
  95. data/lib/ransack/adapters/active_record/3.0/compat.rb +0 -179
  96. data/lib/ransack/adapters/active_record/3.0/context.rb +0 -201
  97. data/lib/ransack/adapters/active_record/3.1/context.rb +0 -215
  98. data/lib/ransack/adapters/active_record/3.2/context.rb +0 -44
  99. data/lib/ransack/adapters/active_record/compat.rb +0 -14
  100. data/lib/ransack/adapters/mongoid/3.2/.gitkeep +0 -0
  101. data/lib/ransack/adapters/mongoid/attributes/attribute.rb +0 -37
  102. data/lib/ransack/adapters/mongoid/attributes/order_predications.rb +0 -17
  103. data/lib/ransack/adapters/mongoid/attributes/predications.rb +0 -141
  104. data/lib/ransack/adapters/mongoid/base.rb +0 -130
  105. data/lib/ransack/adapters/mongoid/context.rb +0 -208
  106. data/lib/ransack/adapters/mongoid/inquiry_hash.rb +0 -23
  107. data/lib/ransack/adapters/mongoid/ransack/constants.rb +0 -88
  108. data/lib/ransack/adapters/mongoid/ransack/context.rb +0 -60
  109. data/lib/ransack/adapters/mongoid/ransack/nodes/condition.rb +0 -27
  110. data/lib/ransack/adapters/mongoid/ransack/translate.rb +0 -13
  111. data/lib/ransack/adapters/mongoid/ransack/visitor.rb +0 -24
  112. data/lib/ransack/adapters/mongoid/table.rb +0 -35
  113. data/lib/ransack/adapters/mongoid.rb +0 -13
  114. data/spec/mongoid/adapters/mongoid/base_spec.rb +0 -276
  115. data/spec/mongoid/adapters/mongoid/context_spec.rb +0 -56
  116. data/spec/mongoid/configuration_spec.rb +0 -102
  117. data/spec/mongoid/dependencies_spec.rb +0 -8
  118. data/spec/mongoid/helpers/ransack_helper.rb +0 -11
  119. data/spec/mongoid/nodes/condition_spec.rb +0 -34
  120. data/spec/mongoid/nodes/grouping_spec.rb +0 -13
  121. data/spec/mongoid/predicate_spec.rb +0 -155
  122. data/spec/mongoid/search_spec.rb +0 -446
  123. data/spec/mongoid/support/mongoid.yml +0 -6
  124. data/spec/mongoid/support/schema.rb +0 -128
  125. data/spec/mongoid/translate_spec.rb +0 -14
  126. data/spec/mongoid_spec_helper.rb +0 -59
  127. data/spec/ransack/dependencies_spec.rb +0 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 1a62534d07f2b79f6ac71228f7b8884c2f97891f
4
- data.tar.gz: 983a58938313d8b5ded1e13ff182f0ee1c27ee48
2
+ SHA256:
3
+ metadata.gz: 2c8153add4e8f7cc4123bb1c6b7f8b6f4db1fdbb65c2d8498a61ef7fc98eea53
4
+ data.tar.gz: 1bae6d37282b621109534060b7c32ecbff7c02366cff88d271d48607ca6fd4cb
5
5
  SHA512:
6
- metadata.gz: eb11af400660331859ddeeb11819d14849fd398ffe3b00368c860ee47baeeace67cb29116d15b46dcad92f1466bb19d6f9e85070baea384ef49500ad1aa1e3a1
7
- data.tar.gz: 5ed69b32c4bd6a65b60e8dd2cccb5c634738b8fe3a3a7266ccc5c6a67ab2b720b016afbfcd8e7740c0ed76dea0c00d46db0c8a61b545b7e7ff66d324bd1057d3
6
+ metadata.gz: ec86fcdc8b81a73c77f3da4e3e9eb2ce7480cae4ce948d64c55d5514d836474fe0c60c727be5d1bca39814afdc96c8bd997e2d245d557689badea217fce67f92
7
+ data.tar.gz: 6526a66311015b73c4132d7c1b95b2006526cf929c47cb5aec91fc79287f07eb0df85a47d22e47d2b88547796501ce8ecb57c81c044e0113f716e45e516b151d
@@ -0,0 +1,3 @@
1
+ ---
2
+
3
+ tidelift: rubygems/ransack
@@ -0,0 +1,12 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ At the moment, only the latest major.minor release stream is supported with
6
+ security updates.
7
+
8
+ ## Reporting a Vulnerability
9
+
10
+ Please use the Tidelift security contact to [report a security
11
+ vulnerability](https://tidelift.com/security). Tidelift will coordinate the fix
12
+ and disclosure.
@@ -0,0 +1,120 @@
1
+ name: test
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ jobs:
8
+ sqlite3:
9
+ runs-on: ubuntu-20.04
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ rails:
14
+ - v6.1.0.rc2
15
+ - v6.0.3
16
+ - 6-0-stable
17
+ - 5-2-stable
18
+ - v5.2.4
19
+ ruby:
20
+ - 2.7.2
21
+ - 2.6.6
22
+ env:
23
+ DB: sqlite3
24
+ RAILS: ${{ matrix.rails }}
25
+ steps:
26
+ - uses: actions/checkout@v2
27
+ - name: Set up Ruby
28
+ uses: ruby/setup-ruby@v1
29
+ with:
30
+ ruby-version: ${{ matrix.ruby }}
31
+ - name: Install dependencies
32
+ run: bundle install
33
+ - name: Run tests
34
+ run: bundle exec rspec
35
+
36
+ mysql:
37
+ runs-on: ubuntu-20.04
38
+ strategy:
39
+ fail-fast: false
40
+ matrix:
41
+ rails:
42
+ - v6.1.0.rc2
43
+ - v6.0.3
44
+ - 6-0-stable
45
+ - 5-2-stable
46
+ - v5.2.4
47
+ ruby:
48
+ - 2.7.2
49
+ - 2.6.6
50
+ env:
51
+ DB: mysql
52
+ RAILS: ${{ matrix.rails }}
53
+ MYSQL_USERNAME: root
54
+ MYSQL_PASSWORD: root
55
+ steps:
56
+ - uses: actions/checkout@v2
57
+ - name: Set up Ruby
58
+ uses: ruby/setup-ruby@v1
59
+ with:
60
+ ruby-version: ${{ matrix.ruby }}
61
+ - name: Startup MySQL
62
+ run: |
63
+ sudo systemctl start mysql.service
64
+ - name: Setup databases
65
+ run: |
66
+ mysql --user=root --password=root --host=127.0.0.1 -e 'create database ransack collate utf8_general_ci;';
67
+ mysql --user=root --password=root --host=127.0.0.1 -e 'use ransack;show variables like "%character%";show variables like "%collation%";';
68
+ - name: Install dependencies
69
+ run: bundle install
70
+ - name: Run tests
71
+ run: bundle exec rspec
72
+
73
+ postgres:
74
+ runs-on: ubuntu-20.04
75
+ strategy:
76
+ fail-fast: false
77
+ matrix:
78
+ rails:
79
+ - v6.1.0.rc2
80
+ - v6.0.3
81
+ - 6-0-stable
82
+ - 5-2-stable
83
+ - v5.2.4
84
+ ruby:
85
+ - 2.7.2
86
+ - 2.6.6
87
+ env:
88
+ DB: postgres
89
+ RAILS: ${{ matrix.rails }}
90
+ DATABASE_USERNAME: postgres
91
+ DATABASE_PASSWORD: postgres
92
+ DATABASE_HOST: 127.0.0.1
93
+ services:
94
+ postgres:
95
+ image: postgres
96
+ ports:
97
+ - 5432:5432
98
+ env:
99
+ POSTGRES_PASSWORD: postgres
100
+ POSTGRES_HOST_AUTH_METHOD: trust
101
+ # Set health checks to wait until postgres has started
102
+ options: >-
103
+ --health-cmd pg_isready
104
+ --health-interval 10s
105
+ --health-timeout 5s
106
+ --health-retries 5
107
+
108
+ steps:
109
+ - uses: actions/checkout@v2
110
+ - name: Set up Ruby
111
+ uses: ruby/setup-ruby@v1
112
+ with:
113
+ ruby-version: ${{ matrix.ruby }}
114
+ - name: Setup databases
115
+ run: |
116
+ psql -h localhost -p 5432 -W postgres -c 'create database ransack;' -U postgres;
117
+ - name: Install dependencies
118
+ run: bundle install
119
+ - name: Run tests
120
+ run: bundle exec rspec
data/.gitignore CHANGED
@@ -2,3 +2,6 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
+ coverage/*
6
+ .DS_Store
7
+ .byebug_history