ransack 4.1.1 → 4.4.0
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 +4 -4
- data/README.md +5 -3
- data/lib/polyamorous/activerecord/join_association_7_2.rb +55 -0
- data/lib/polyamorous/polyamorous.rb +5 -1
- data/lib/ransack/adapters/active_record/context.rb +32 -5
- data/lib/ransack/constants.rb +1 -1
- data/lib/ransack/context.rb +7 -4
- data/lib/ransack/helpers/form_builder.rb +6 -7
- data/lib/ransack/helpers/form_helper.rb +86 -20
- data/lib/ransack/invalid_search_error.rb +3 -0
- data/lib/ransack/locale/ja.yml +51 -51
- data/lib/ransack/locale/ko.yml +70 -0
- data/lib/ransack/locale/uk.yml +72 -0
- data/lib/ransack/nodes/condition.rb +39 -7
- data/lib/ransack/nodes/grouping.rb +1 -1
- data/lib/ransack/nodes/sort.rb +1 -1
- data/lib/ransack/nodes/value.rb +9 -1
- data/lib/ransack/search.rb +4 -3
- data/lib/ransack/version.rb +1 -1
- data/lib/ransack.rb +9 -0
- data/spec/polyamorous/join_association_spec.rb +0 -1
- data/spec/polyamorous/join_dependency_spec.rb +0 -1
- data/spec/ransack/adapters/active_record/base_spec.rb +106 -3
- data/spec/ransack/adapters/active_record/context_spec.rb +72 -0
- data/spec/ransack/helpers/form_builder_spec.rb +0 -2
- data/spec/ransack/helpers/form_helper_spec.rb +219 -5
- data/spec/ransack/nodes/condition_spec.rb +230 -0
- data/spec/ransack/nodes/grouping_spec.rb +2 -2
- data/spec/ransack/nodes/value_spec.rb +12 -1
- data/spec/ransack/predicate_spec.rb +16 -9
- data/spec/ransack/search_spec.rb +121 -1
- data/spec/ransack/translate_spec.rb +0 -1
- data/spec/spec_helper.rb +2 -3
- data/spec/support/schema.rb +42 -0
- metadata +17 -86
- data/.github/FUNDING.yml +0 -3
- data/.github/SECURITY.md +0 -12
- data/.github/workflows/codeql.yml +0 -72
- data/.github/workflows/cronjob.yml +0 -99
- data/.github/workflows/deploy.yml +0 -35
- data/.github/workflows/rubocop.yml +0 -20
- data/.github/workflows/test-deploy.yml +0 -29
- data/.github/workflows/test.yml +0 -131
- data/.gitignore +0 -7
- data/.nojekyll +0 -0
- data/.rubocop.yml +0 -50
- data/CHANGELOG.md +0 -1176
- data/CONTRIBUTING.md +0 -171
- data/Gemfile +0 -53
- data/Rakefile +0 -24
- data/bug_report_templates/test-ransack-scope-and-column-same-name.rb +0 -78
- data/bug_report_templates/test-ransacker-arel-present-predicate.rb +0 -75
- data/docs/.gitignore +0 -19
- data/docs/.nojekyll +0 -0
- data/docs/babel.config.js +0 -3
- data/docs/blog/2022-03-27-ransack-3.0.0.md +0 -20
- data/docs/docs/getting-started/_category_.json +0 -4
- data/docs/docs/getting-started/advanced-mode.md +0 -46
- data/docs/docs/getting-started/configuration.md +0 -47
- data/docs/docs/getting-started/search-matches.md +0 -67
- data/docs/docs/getting-started/simple-mode.md +0 -288
- data/docs/docs/getting-started/sorting.md +0 -71
- data/docs/docs/getting-started/using-predicates.md +0 -282
- data/docs/docs/going-further/_category_.json +0 -4
- data/docs/docs/going-further/acts-as-taggable-on.md +0 -114
- data/docs/docs/going-further/associations.md +0 -70
- data/docs/docs/going-further/custom-predicates.md +0 -52
- data/docs/docs/going-further/documentation.md +0 -43
- data/docs/docs/going-further/exporting-to-csv.md +0 -49
- data/docs/docs/going-further/external-guides.md +0 -57
- data/docs/docs/going-further/form-customisation.md +0 -63
- data/docs/docs/going-further/i18n.md +0 -53
- data/docs/docs/going-further/img/create_release.png +0 -0
- data/docs/docs/going-further/merging-searches.md +0 -41
- data/docs/docs/going-further/other-notes.md +0 -428
- data/docs/docs/going-further/polymorphic-search.md +0 -46
- data/docs/docs/going-further/ransackers.md +0 -331
- data/docs/docs/going-further/release_process.md +0 -36
- data/docs/docs/going-further/saving-queries.md +0 -82
- data/docs/docs/going-further/searching-postgres.md +0 -57
- data/docs/docs/going-further/wiki-contributors.md +0 -82
- data/docs/docs/intro.md +0 -99
- data/docs/docusaurus.config.js +0 -120
- data/docs/package.json +0 -42
- data/docs/sidebars.js +0 -31
- data/docs/src/components/HomepageFeatures/index.js +0 -64
- data/docs/src/components/HomepageFeatures/styles.module.css +0 -11
- data/docs/src/css/custom.css +0 -39
- data/docs/src/pages/index.module.css +0 -23
- data/docs/src/pages/markdown-page.md +0 -7
- data/docs/static/.nojekyll +0 -0
- data/docs/static/img/docusaurus.png +0 -0
- data/docs/static/img/favicon.ico +0 -0
- data/docs/static/img/logo.svg +0 -1
- data/docs/static/img/tutorial/docsVersionDropdown.png +0 -0
- data/docs/static/img/tutorial/localeDropdown.png +0 -0
- data/docs/static/img/undraw_docusaurus_mountain.svg +0 -171
- data/docs/static/img/undraw_docusaurus_react.svg +0 -170
- data/docs/static/img/undraw_docusaurus_tree.svg +0 -40
- data/docs/static/logo/ransack-h.png +0 -0
- data/docs/static/logo/ransack-h.svg +0 -34
- data/docs/static/logo/ransack-v.png +0 -0
- data/docs/static/logo/ransack-v.svg +0 -34
- data/docs/static/logo/ransack.png +0 -0
- data/docs/static/logo/ransack.svg +0 -21
- data/docs/yarn.lock +0 -8879
- data/ransack.gemspec +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4fe4a128cacdb920f2efe5fc5063cd21b8fa1a4a527fa07e84123f2ead7a6694
|
4
|
+
data.tar.gz: 82f66ffeaa4d8bed52614374fe71617bb1c2d85ac1745dfca7e4520e07782545
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a80ce4b0da981c6e3b2d18de8c742d3598a2a7479b44d04adaa1ce3c60a81fa4377f706c78048c1d72f719d488afd379c303b55811053d8613eb82cf0f0dfcad
|
7
|
+
data.tar.gz: cd3f836f63aa19596a3510961bbe64a1f9abcc858473bf9516623e5fe76908bcbb346d36cf1cd7cb83094f0a3c0f4bcdb942b0e137a9020cd8772e28d01d9f51
|
data/README.md
CHANGED
@@ -13,7 +13,7 @@ There are advanced searching solutions around, like ElasticSearch or Algolia. **
|
|
13
13
|
|
14
14
|
Ready to move beyond the basics? Use **advanced features** like i18n and extensive configuration options.
|
15
15
|
|
16
|
-
Ransack is supported for Rails
|
16
|
+
Ransack is supported for Rails 8.0, 7.2, 7.1 on Ruby 3.1 and later.
|
17
17
|
|
18
18
|
## Installation
|
19
19
|
|
@@ -33,9 +33,11 @@ gem 'ransack', :github => 'activerecord-hackery/ransack', :branch => 'main'
|
|
33
33
|
|
34
34
|
### Documentation
|
35
35
|
|
36
|
-
There is [extensive documentation on Ransack](https://activerecord-hackery.github.io/ransack/), which is a [Docusaurus](https://docusaurus.io/) project and run as a GitHub Pages site.
|
36
|
+
There is [extensive documentation on Ransack](https://activerecord-hackery.github.io/ransack/), which is a [Docusaurus](https://docusaurus.io/) project and run as a GitHub Pages site. Alternatively there is [AI Generated documentation](https://deepwiki.com/activerecord-hackery/ransack/1-overview) produced by [devin.ai](https://devin.ai/).
|
37
37
|
|
38
|
-
|
38
|
+
This [gist](https://gist.github.com/raghubetina/d5fc3df67ddbadcac271) has a quick-start cheatsheet, created by [@raghubetina](https://gist.github.com/raghubetina)
|
39
|
+
|
40
|
+
## Issue tracker
|
39
41
|
|
40
42
|
* Before filing an issue, please read the [Contributing Guide](CONTRIBUTING.md).
|
41
43
|
* File an issue if a bug is caused by Ransack, is new (has not already been reported), and _can be reproduced from the information you provide_.
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Polyamorous
|
2
|
+
module JoinAssociationExtensions
|
3
|
+
# Same as #join_constraints, but instead of constructing tables from the
|
4
|
+
# given block, uses the ones passed
|
5
|
+
def join_constraints_with_tables(foreign_table, foreign_klass, join_type, alias_tracker, tables)
|
6
|
+
joins = []
|
7
|
+
chain = []
|
8
|
+
|
9
|
+
reflection.chain.each.with_index do |reflection, i|
|
10
|
+
table = tables[i]
|
11
|
+
|
12
|
+
@table ||= table
|
13
|
+
chain << [reflection, table]
|
14
|
+
end
|
15
|
+
|
16
|
+
base_klass.with_connection do |connection|
|
17
|
+
# The chain starts with the target table, but we want to end with it here (makes
|
18
|
+
# more sense in this context), so we reverse
|
19
|
+
chain.reverse_each do |reflection, table|
|
20
|
+
klass = reflection.klass
|
21
|
+
|
22
|
+
join_scope = reflection.join_scope(table, foreign_table, foreign_klass)
|
23
|
+
|
24
|
+
unless join_scope.references_values.empty?
|
25
|
+
join_dependency = join_scope.construct_join_dependency(
|
26
|
+
join_scope.eager_load_values | join_scope.includes_values, Arel::Nodes::OuterJoin
|
27
|
+
)
|
28
|
+
join_scope.joins!(join_dependency)
|
29
|
+
end
|
30
|
+
|
31
|
+
arel = join_scope.arel(alias_tracker.aliases)
|
32
|
+
nodes = arel.constraints.first
|
33
|
+
|
34
|
+
if nodes.is_a?(Arel::Nodes::And)
|
35
|
+
others = nodes.children.extract! do |node|
|
36
|
+
!Arel.fetch_attribute(node) { |attr| attr.relation.name == table.name }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
joins << table.create_join(table, table.create_on(nodes), join_type)
|
41
|
+
|
42
|
+
if others && !others.empty?
|
43
|
+
joins.concat arel.join_sources
|
44
|
+
append_constraints(connection, joins.last, others)
|
45
|
+
end
|
46
|
+
|
47
|
+
# The current table in this iteration becomes the foreign table in the next
|
48
|
+
foreign_table, foreign_klass = table, klass
|
49
|
+
end
|
50
|
+
|
51
|
+
joins
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
ActiveSupport.on_load(:active_record) do
|
2
2
|
module Polyamorous
|
3
3
|
InnerJoin = Arel::Nodes::InnerJoin
|
4
4
|
OuterJoin = Arel::Nodes::OuterJoin
|
@@ -15,6 +15,10 @@ if defined?(::ActiveRecord)
|
|
15
15
|
require 'polyamorous/activerecord/join_dependency'
|
16
16
|
require 'polyamorous/activerecord/reflection'
|
17
17
|
|
18
|
+
if ::ActiveRecord.version >= ::Gem::Version.new("7.2") && ::ActiveRecord.version < ::Gem::Version.new("7.2.2.1")
|
19
|
+
require "polyamorous/activerecord/join_association_7_2"
|
20
|
+
end
|
21
|
+
|
18
22
|
ActiveRecord::Reflection::AbstractReflection.send(:prepend, Polyamorous::ReflectionExtensions)
|
19
23
|
|
20
24
|
Polyamorous::JoinDependency.send(:prepend, Polyamorous::JoinDependencyExtensions)
|
@@ -19,7 +19,8 @@ module Ransack
|
|
19
19
|
unless schema_cache.send(:data_source_exists?, table)
|
20
20
|
raise "No table named #{table} exists."
|
21
21
|
end
|
22
|
-
attr.klass.columns.find { |column| column.name == name }
|
22
|
+
column = attr.klass.columns.find { |column| column.name == name }
|
23
|
+
column&.type
|
23
24
|
end
|
24
25
|
|
25
26
|
def evaluate(search, opts = {})
|
@@ -110,7 +111,7 @@ module Ransack
|
|
110
111
|
#
|
111
112
|
def join_sources
|
112
113
|
base, joins = begin
|
113
|
-
alias_tracker =
|
114
|
+
alias_tracker = @object.alias_tracker
|
114
115
|
constraints = @join_dependency.join_constraints(@object.joins_values, alias_tracker, @object.references_values)
|
115
116
|
|
116
117
|
[
|
@@ -171,7 +172,25 @@ module Ransack
|
|
171
172
|
join_constraints.each do |j|
|
172
173
|
subquery.join_sources << Arel::Nodes::InnerJoin.new(j.left, j.right)
|
173
174
|
end
|
174
|
-
|
175
|
+
|
176
|
+
# Handle polymorphic associations where correlated_key is an array
|
177
|
+
if correlated_key.is_a?(Array)
|
178
|
+
# For polymorphic associations, we need to add conditions for both the foreign key and type
|
179
|
+
correlated_key.each_with_index do |key, index|
|
180
|
+
if index == 0
|
181
|
+
# This is the foreign key
|
182
|
+
subquery = subquery.where(key.eq(primary_key))
|
183
|
+
else
|
184
|
+
# This is the type key, which should be equal to the model name
|
185
|
+
subquery = subquery.where(key.eq(@klass.name))
|
186
|
+
end
|
187
|
+
end
|
188
|
+
else
|
189
|
+
# Original behavior for non-polymorphic associations
|
190
|
+
subquery = subquery.where(correlated_key.eq(primary_key))
|
191
|
+
end
|
192
|
+
|
193
|
+
subquery
|
175
194
|
end
|
176
195
|
|
177
196
|
def primary_key
|
@@ -201,7 +220,15 @@ module Ransack
|
|
201
220
|
nil
|
202
221
|
end
|
203
222
|
when Arel::Nodes::And
|
204
|
-
|
223
|
+
# And may have multiple children, so we need to check all, not via left/right
|
224
|
+
if join_root.children.any?
|
225
|
+
join_root.children.each do |child|
|
226
|
+
key = extract_correlated_key(child)
|
227
|
+
return key if key
|
228
|
+
end
|
229
|
+
else
|
230
|
+
extract_correlated_key(join_root.left) || extract_correlated_key(join_root.right)
|
231
|
+
end
|
205
232
|
else
|
206
233
|
# eg parent was Arel::Nodes::And and the evaluated side was one of
|
207
234
|
# Arel::Nodes::Grouping or MultiTenant::TenantEnforcementClause
|
@@ -278,7 +305,7 @@ module Ransack
|
|
278
305
|
|
279
306
|
join_list = join_nodes + convert_join_strings_to_ast(relation.table, string_joins)
|
280
307
|
|
281
|
-
alias_tracker =
|
308
|
+
alias_tracker = relation.alias_tracker(join_list)
|
282
309
|
join_dependency = Polyamorous::JoinDependency.new(relation.klass, relation.table, association_joins, Arel::Nodes::OuterJoin)
|
283
310
|
join_dependency.instance_variable_set(:@alias_tracker, alias_tracker)
|
284
311
|
join_nodes.each do |join|
|
data/lib/ransack/constants.rb
CHANGED
@@ -165,7 +165,7 @@ module Ransack
|
|
165
165
|
when "Mysql2".freeze
|
166
166
|
# Necessary for MySQL
|
167
167
|
unescaped.to_s.gsub(/([\\%_])/, '\\\\\\1')
|
168
|
-
when "PostgreSQL".freeze
|
168
|
+
when "PostGIS".freeze, "PostgreSQL".freeze
|
169
169
|
# Necessary for PostgreSQL
|
170
170
|
unescaped.to_s.gsub(/([\\%_.])/, '\\\\\\1')
|
171
171
|
else
|
data/lib/ransack/context.rb
CHANGED
@@ -77,6 +77,9 @@ module Ransack
|
|
77
77
|
return unless @klass.method(scope) && args != false
|
78
78
|
@object = if scope_arity(scope) < 1 && args == true
|
79
79
|
@object.public_send(scope)
|
80
|
+
elsif scope_arity(scope) == 1 && args.is_a?(Array)
|
81
|
+
# For scopes with arity 1, pass the array as a single argument instead of splatting
|
82
|
+
@object.public_send(scope, args)
|
80
83
|
else
|
81
84
|
@object.public_send(scope, *args)
|
82
85
|
end
|
@@ -152,16 +155,16 @@ module Ransack
|
|
152
155
|
end
|
153
156
|
|
154
157
|
def ransackable_alias(str)
|
155
|
-
klass._ransack_aliases.fetch(str, str)
|
158
|
+
klass._ransack_aliases.fetch(str, klass._ransack_aliases.fetch(str.to_sym, str))
|
156
159
|
end
|
157
160
|
|
158
161
|
def ransackable_attribute?(str, klass)
|
159
|
-
klass.ransackable_attributes(auth_object).
|
160
|
-
klass.ransortable_attributes(auth_object).
|
162
|
+
klass.ransackable_attributes(auth_object).any? { |s| s.to_sym == str.to_sym } ||
|
163
|
+
klass.ransortable_attributes(auth_object).any? { |s| s.to_sym == str.to_sym }
|
161
164
|
end
|
162
165
|
|
163
166
|
def ransackable_association?(str, klass)
|
164
|
-
klass.ransackable_associations(auth_object).
|
167
|
+
klass.ransackable_associations(auth_object).any? { |s| s.to_sym == str.to_sym }
|
165
168
|
end
|
166
169
|
|
167
170
|
def ransackable_scope?(str, klass)
|
@@ -6,13 +6,12 @@ module ActionView::Helpers::Tags
|
|
6
6
|
# https://github.com/rails/rails/commit/c1a118a
|
7
7
|
class Base
|
8
8
|
private
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
9
|
+
|
10
|
+
def value
|
11
|
+
if @allow_method_names_outside_object
|
12
|
+
object.send @method_name if object && object.respond_to?(@method_name, true)
|
13
|
+
else
|
14
|
+
object.send @method_name if object
|
16
15
|
end
|
17
16
|
end
|
18
17
|
end
|
@@ -7,30 +7,48 @@ module Ransack
|
|
7
7
|
# <%= search_form_for(@q) do |f| %>
|
8
8
|
#
|
9
9
|
def search_form_for(record, options = {}, &proc)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
10
|
+
search = extract_search_and_set_url(record, options, 'search_form_for')
|
11
|
+
options[:html] ||= {}
|
12
|
+
html_options = build_html_options(search, options, :get)
|
13
|
+
finalize_form_options(options, html_options)
|
14
|
+
form_for(record, options, &proc)
|
15
|
+
end
|
16
|
+
|
17
|
+
# +search_form_with+
|
18
|
+
#
|
19
|
+
# <%= search_form_with(model: @q) do |f| %>
|
20
|
+
#
|
21
|
+
def search_form_with(record_or_options = {}, options = {}, &proc)
|
22
|
+
if record_or_options.is_a?(Hash) && record_or_options.key?(:model)
|
23
|
+
# Called with keyword arguments: search_form_with(model: @q)
|
24
|
+
options = record_or_options
|
25
|
+
record = options.delete(:model)
|
20
26
|
else
|
21
|
-
|
22
|
-
|
27
|
+
# Called with positional arguments: search_form_with(@q)
|
28
|
+
record = record_or_options
|
23
29
|
end
|
30
|
+
search = extract_search_and_set_url(record, options, 'search_form_with')
|
24
31
|
options[:html] ||= {}
|
25
|
-
html_options =
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
}
|
30
|
-
options[:as] ||= Ransack.options[:search_key]
|
31
|
-
options[:html].reverse_merge!(html_options)
|
32
|
-
options[:builder] ||= FormBuilder
|
32
|
+
html_options = build_html_options(search, options, :get)
|
33
|
+
finalize_form_with_options(options, html_options)
|
34
|
+
form_with(model: search, **options, &proc)
|
35
|
+
end
|
33
36
|
|
37
|
+
# +turbo_search_form_for+
|
38
|
+
#
|
39
|
+
# <%= turbo_search_form_for(@q) do |f| %>
|
40
|
+
#
|
41
|
+
# This is a turbo-enabled version of search_form_for that submits via turbo streams
|
42
|
+
# instead of traditional HTML GET requests. Useful for seamless integration with
|
43
|
+
# paginated results and other turbo-enabled components.
|
44
|
+
#
|
45
|
+
def turbo_search_form_for(record, options = {}, &proc)
|
46
|
+
search = extract_search_and_set_url(record, options, 'turbo_search_form_for')
|
47
|
+
options[:html] ||= {}
|
48
|
+
turbo_options = build_turbo_options(options)
|
49
|
+
method = options.delete(:method) || :post
|
50
|
+
html_options = build_html_options(search, options, method).merge(turbo_options)
|
51
|
+
finalize_form_options(options, html_options)
|
34
52
|
form_for(record, options, &proc)
|
35
53
|
end
|
36
54
|
|
@@ -68,6 +86,54 @@ module Ransack
|
|
68
86
|
|
69
87
|
private
|
70
88
|
|
89
|
+
def extract_search_and_set_url(record, options, method_name)
|
90
|
+
if record.is_a? Ransack::Search
|
91
|
+
search = record
|
92
|
+
options[:url] ||= polymorphic_path(
|
93
|
+
search.klass, format: options.delete(:format)
|
94
|
+
)
|
95
|
+
search
|
96
|
+
elsif record.is_a?(Array) &&
|
97
|
+
(search = record.detect { |o| o.is_a?(Ransack::Search) })
|
98
|
+
options[:url] ||= polymorphic_path(
|
99
|
+
options_for(record), format: options.delete(:format)
|
100
|
+
)
|
101
|
+
search
|
102
|
+
else
|
103
|
+
raise ArgumentError,
|
104
|
+
"No Ransack::Search object was provided to #{method_name}!"
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def build_turbo_options(options)
|
109
|
+
data_options = {}
|
110
|
+
if options[:turbo_frame]
|
111
|
+
data_options[:turbo_frame] = options.delete(:turbo_frame)
|
112
|
+
end
|
113
|
+
data_options[:turbo_action] = options.delete(:turbo_action) || 'advance'
|
114
|
+
{ data: data_options }
|
115
|
+
end
|
116
|
+
|
117
|
+
def build_html_options(search, options, method)
|
118
|
+
{
|
119
|
+
class: html_option_for(options[:class], search),
|
120
|
+
id: html_option_for(options[:id], search),
|
121
|
+
method: method
|
122
|
+
}
|
123
|
+
end
|
124
|
+
|
125
|
+
def finalize_form_options(options, html_options)
|
126
|
+
options[:as] ||= Ransack.options[:search_key]
|
127
|
+
options[:html].reverse_merge!(html_options)
|
128
|
+
options[:builder] ||= FormBuilder
|
129
|
+
end
|
130
|
+
|
131
|
+
def finalize_form_with_options(options, html_options)
|
132
|
+
options[:scope] ||= Ransack.options[:search_key]
|
133
|
+
options[:html].reverse_merge!(html_options)
|
134
|
+
options[:builder] ||= FormBuilder
|
135
|
+
end
|
136
|
+
|
71
137
|
def options_for(record)
|
72
138
|
record.map { |r| parse_record(r) }
|
73
139
|
end
|
data/lib/ransack/locale/ja.yml
CHANGED
@@ -14,57 +14,57 @@ ja:
|
|
14
14
|
asc: "昇順"
|
15
15
|
desc: "降順"
|
16
16
|
predicates:
|
17
|
-
eq: "
|
18
|
-
eq_any: "
|
19
|
-
eq_all: "
|
20
|
-
not_eq: "
|
21
|
-
not_eq_any: "
|
22
|
-
not_eq_all: "
|
23
|
-
matches: "
|
24
|
-
matches_any: "
|
25
|
-
matches_all: "
|
26
|
-
does_not_match: "
|
27
|
-
does_not_match_any: "
|
28
|
-
does_not_match_all: "
|
29
|
-
lt: "
|
30
|
-
lt_any: "
|
31
|
-
lt_all: "
|
32
|
-
lteq: "
|
33
|
-
lteq_any: "
|
34
|
-
lteq_all: "
|
35
|
-
gt: "
|
36
|
-
gt_any: "
|
37
|
-
gt_all: "
|
38
|
-
gteq: "
|
39
|
-
gteq_any: "
|
40
|
-
gteq_all: "
|
41
|
-
in: "
|
42
|
-
in_any: "
|
43
|
-
in_all: "
|
44
|
-
not_in: "
|
45
|
-
not_in_any: "
|
46
|
-
not_in_all: "
|
47
|
-
cont: "
|
48
|
-
cont_any: "
|
49
|
-
cont_all: "
|
50
|
-
not_cont: "
|
51
|
-
not_cont_any: "
|
52
|
-
not_cont_all: "
|
53
|
-
start: "
|
54
|
-
start_any: "
|
55
|
-
start_all: "
|
56
|
-
not_start: "
|
57
|
-
not_start_any: "
|
58
|
-
not_start_all: "
|
59
|
-
end: "
|
60
|
-
end_any: "
|
61
|
-
end_all: "
|
62
|
-
not_end: "
|
63
|
-
not_end_any: "
|
64
|
-
not_end_all: "
|
17
|
+
eq: "等しい"
|
18
|
+
eq_any: "いずれかに等しい"
|
19
|
+
eq_all: "全てに等しい"
|
20
|
+
not_eq: "等しくない"
|
21
|
+
not_eq_any: "いずれかに等しくない"
|
22
|
+
not_eq_all: "全てと等しくない"
|
23
|
+
matches: "合致している"
|
24
|
+
matches_any: "いずれかと合致している"
|
25
|
+
matches_all: "全てと合致している"
|
26
|
+
does_not_match: "合致していない"
|
27
|
+
does_not_match_any: "いずれかに合致していない"
|
28
|
+
does_not_match_all: "全てに合致していない"
|
29
|
+
lt: "小さい"
|
30
|
+
lt_any: "いずれかより小さい"
|
31
|
+
lt_all: "全てよりも小さい"
|
32
|
+
lteq: "小さいか等しい"
|
33
|
+
lteq_any: "いずれかより小さいか等しい"
|
34
|
+
lteq_all: "全てより小さいか等しい"
|
35
|
+
gt: "大きい"
|
36
|
+
gt_any: "いずれかより大きい"
|
37
|
+
gt_all: "全てより大きい"
|
38
|
+
gteq: "大きいか等しい"
|
39
|
+
gteq_any: "いずれかより大きいか等しい"
|
40
|
+
gteq_all: "全てより大きいか等しい"
|
41
|
+
in: "範囲内である"
|
42
|
+
in_any: "いずれかの範囲内である"
|
43
|
+
in_all: "全ての範囲内である"
|
44
|
+
not_in: "範囲内でない"
|
45
|
+
not_in_any: "いずれかの範囲内でない"
|
46
|
+
not_in_all: "全ての範囲内"
|
47
|
+
cont: "含む"
|
48
|
+
cont_any: "いずれかを含む"
|
49
|
+
cont_all: "全てを含む"
|
50
|
+
not_cont: "含まない"
|
51
|
+
not_cont_any: "いずれかを含まない"
|
52
|
+
not_cont_all: "全てを含まない"
|
53
|
+
start: "始まる"
|
54
|
+
start_any: "どれかで始まる"
|
55
|
+
start_all: "全てで始まる"
|
56
|
+
not_start: "始まらない"
|
57
|
+
not_start_any: "いずれかで始まらない"
|
58
|
+
not_start_all: "全てで始まらない"
|
59
|
+
end: "終わる"
|
60
|
+
end_any: "いずれかで終わる"
|
61
|
+
end_all: "全てで終わる"
|
62
|
+
not_end: "どれでも終わらない"
|
63
|
+
not_end_any: "いずれかで終わらない"
|
64
|
+
not_end_all: "全てで終わらない"
|
65
65
|
'true': "真"
|
66
66
|
'false': "偽"
|
67
|
-
present: "
|
68
|
-
blank: "
|
67
|
+
present: "存在する"
|
68
|
+
blank: "空である"
|
69
69
|
'null': "無効"
|
70
|
-
not_null: "
|
70
|
+
not_null: "無効ではない"
|
@@ -0,0 +1,70 @@
|
|
1
|
+
ko:
|
2
|
+
ransack:
|
3
|
+
search: "검색"
|
4
|
+
predicate: "조건"
|
5
|
+
and: "그리고"
|
6
|
+
or: "또는"
|
7
|
+
any: "어떤 것이든"
|
8
|
+
all: "모두"
|
9
|
+
combinator: "조합기"
|
10
|
+
attribute: "속성"
|
11
|
+
value: "값"
|
12
|
+
condition: "조건"
|
13
|
+
sort: "정렬"
|
14
|
+
asc: "오름차순"
|
15
|
+
desc: "내림차순"
|
16
|
+
predicates:
|
17
|
+
eq: "같음"
|
18
|
+
eq_any: "어떤 것이든 같음"
|
19
|
+
eq_all: "모두 같음"
|
20
|
+
not_eq: "같지 않음"
|
21
|
+
not_eq_any: "어떤 것이든 같지 않음"
|
22
|
+
not_eq_all: "모두 같지 않음"
|
23
|
+
matches: "일치함"
|
24
|
+
matches_any: "어떤 것이든 일치함"
|
25
|
+
matches_all: "모두 일치함"
|
26
|
+
does_not_match: "일치하지 않음"
|
27
|
+
does_not_match_any: "어떤 것이든 일치하지 않음"
|
28
|
+
does_not_match_all: "모두 일치하지 않음"
|
29
|
+
lt: "보다 작음"
|
30
|
+
lt_any: "어떤 것이든 보다 작음"
|
31
|
+
lt_all: "모두 보다 작음"
|
32
|
+
lteq: "보다 작거나 같음"
|
33
|
+
lteq_any: "어떤 것이든 보다 작거나 같음"
|
34
|
+
lteq_all: "모두 보다 작거나 같음"
|
35
|
+
gt: "보다 큼"
|
36
|
+
gt_any: "어떤 것이든 보다 큼"
|
37
|
+
gt_all: "모두 보다 큼"
|
38
|
+
gteq: "보다 크거나 같음"
|
39
|
+
gteq_any: "어떤 것이든 보다 크거나 같음"
|
40
|
+
gteq_all: "모두 보다 크거나 같음"
|
41
|
+
in: "포함됨"
|
42
|
+
in_any: "어떤 것이든 포함됨"
|
43
|
+
in_all: "모두 포함됨"
|
44
|
+
not_in: "포함되지 않음"
|
45
|
+
not_in_any: "어떤 것이든 포함되지 않음"
|
46
|
+
not_in_all: "모두 포함되지 않음"
|
47
|
+
cont: "포함함"
|
48
|
+
cont_any: "어떤 것이든 포함함"
|
49
|
+
cont_all: "모두 포함함"
|
50
|
+
not_cont: "포함하지 않음"
|
51
|
+
not_cont_any: "어떤 것이든 포함하지 않음"
|
52
|
+
not_cont_all: "모두 포함하지 않음"
|
53
|
+
start: "시작함"
|
54
|
+
start_any: "어떤 것이든 시작함"
|
55
|
+
start_all: "모두 시작함"
|
56
|
+
not_start: "시작하지 않음"
|
57
|
+
not_start_any: "어떤 것이든 시작하지 않음"
|
58
|
+
not_start_all: "모두 시작하지 않음"
|
59
|
+
end: "끝남"
|
60
|
+
end_any: "어떤 것이든 끝남"
|
61
|
+
end_all: "모두 끝남"
|
62
|
+
not_end: "끝나지 않음"
|
63
|
+
not_end_any: "어떤 것이든 끝나지 않음"
|
64
|
+
not_end_all: "모두 끝나지 않음"
|
65
|
+
'true': "참"
|
66
|
+
'false': "거짓"
|
67
|
+
present: "존재함"
|
68
|
+
blank: "비어있음"
|
69
|
+
'null': "널"
|
70
|
+
not_null: "널이 아님"
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# Інші переклади на https://github.com/activerecord-hackery/ransack/blob/main/lib/ransack/locale
|
2
|
+
#
|
3
|
+
uk:
|
4
|
+
ransack:
|
5
|
+
search: пошук
|
6
|
+
predicate: предикат
|
7
|
+
and: і
|
8
|
+
or: або
|
9
|
+
any: будь-який
|
10
|
+
all: усі
|
11
|
+
combinator: комбінатор
|
12
|
+
attribute: атрибут
|
13
|
+
value: значення
|
14
|
+
condition: умова
|
15
|
+
sort: сортування
|
16
|
+
asc: за зростанням
|
17
|
+
desc: за спаданням
|
18
|
+
predicates:
|
19
|
+
eq: рівний
|
20
|
+
eq_any: рівний будь-якому
|
21
|
+
eq_all: рівний усім
|
22
|
+
not_eq: не рівний
|
23
|
+
not_eq_any: не рівний будь-якому
|
24
|
+
not_eq_all: не рівний усім
|
25
|
+
matches: збігається
|
26
|
+
matches_any: збігається з будь-яким
|
27
|
+
matches_all: збігається з усіма
|
28
|
+
does_not_match: не збігається
|
29
|
+
does_not_match_any: не збігається з будь-яким
|
30
|
+
does_not_match_all: не збігається з усіма
|
31
|
+
lt: менше ніж
|
32
|
+
lt_any: менше за будь-який
|
33
|
+
lt_all: менше за всі
|
34
|
+
lteq: менше або рівне
|
35
|
+
lteq_any: менше або рівне будь-якому
|
36
|
+
lteq_all: менше або рівне всім
|
37
|
+
gt: більше ніж
|
38
|
+
gt_any: більше ніж будь-який
|
39
|
+
gt_all: більше ніж усі
|
40
|
+
gteq: більше або рівне
|
41
|
+
gteq_any: більше або рівне будь-якому
|
42
|
+
gteq_all: більше або рівне всім
|
43
|
+
in: міститься у
|
44
|
+
in_any: міститься в будь-якому
|
45
|
+
in_all: міститься в усіх
|
46
|
+
not_in: не міститься у
|
47
|
+
not_in_any: не міститься в будь-якому
|
48
|
+
not_in_all: не міститься в усіх
|
49
|
+
cont: містить
|
50
|
+
cont_any: містить будь-який
|
51
|
+
cont_all: містить усі
|
52
|
+
not_cont: не містить
|
53
|
+
not_cont_any: не містить жодного
|
54
|
+
not_cont_all: не містить усіх
|
55
|
+
start: починається з
|
56
|
+
start_any: починається з будь-якого
|
57
|
+
start_all: починається з усіх
|
58
|
+
not_start: не починається з
|
59
|
+
not_start_any: не починається з будь-якого
|
60
|
+
not_start_all: не починається з усіх
|
61
|
+
end: закінчується на
|
62
|
+
end_any: закінчується на будь-який
|
63
|
+
end_all: закінчується на всі
|
64
|
+
not_end: не закінчується на
|
65
|
+
not_end_any: не закінчується на будь-який
|
66
|
+
not_end_all: не закінчується на всі
|
67
|
+
'true': так
|
68
|
+
'false': ні
|
69
|
+
present: присутній
|
70
|
+
blank: порожній
|
71
|
+
'null': нульовий
|
72
|
+
not_null: не нульовий
|