ransack 1.8.4 → 3.2.1
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 +5 -5
- data/.github/FUNDING.yml +3 -0
- data/.github/SECURITY.md +12 -0
- data/.github/workflows/cronjob.yml +102 -0
- data/.github/workflows/deploy.yml +35 -0
- data/.github/workflows/rubocop.yml +20 -0
- data/.github/workflows/test-deploy.yml +29 -0
- data/.github/workflows/test.yml +130 -0
- data/.gitignore +3 -0
- data/{lib/ransack/adapters/mongoid/3.2/.gitkeep → .nojekyll} +0 -0
- data/.rubocop.yml +44 -0
- data/CHANGELOG.md +352 -0
- data/CONTRIBUTING.md +25 -13
- data/Gemfile +26 -27
- data/README.md +65 -815
- data/Rakefile +1 -22
- data/bug_report_templates/test-ransack-scope-and-column-same-name.rb +78 -0
- data/bug_report_templates/test-ransacker-arel-present-predicate.rb +71 -0
- data/docs/.gitignore +19 -0
- data/docs/.nojekyll +0 -0
- data/docs/babel.config.js +3 -0
- data/docs/blog/2022-03-27-ransack-3.0.0.md +20 -0
- data/docs/docs/getting-started/_category_.json +4 -0
- data/docs/docs/getting-started/advanced-mode.md +46 -0
- data/docs/docs/getting-started/configuration.md +47 -0
- data/docs/docs/getting-started/search-matches.md +67 -0
- data/docs/docs/getting-started/simple-mode.md +284 -0
- data/docs/docs/getting-started/sorting.md +79 -0
- data/docs/docs/getting-started/using-predicates.md +282 -0
- data/docs/docs/going-further/_category_.json +4 -0
- data/docs/docs/going-further/acts-as-taggable-on.md +114 -0
- data/docs/docs/going-further/associations.md +70 -0
- data/docs/docs/going-further/custom-predicates.md +52 -0
- data/docs/docs/going-further/documentation.md +43 -0
- data/docs/docs/going-further/exporting-to-csv.md +49 -0
- data/docs/docs/going-further/external-guides.md +57 -0
- data/docs/docs/going-further/form-customisation.md +63 -0
- data/docs/docs/going-further/i18n.md +53 -0
- data/docs/docs/going-further/img/create_release.png +0 -0
- data/docs/docs/going-further/merging-searches.md +41 -0
- data/docs/docs/going-further/other-notes.md +428 -0
- data/docs/docs/going-further/polymorphic-search.md +40 -0
- data/docs/docs/going-further/ransackers.md +331 -0
- data/docs/docs/going-further/release_process.md +36 -0
- data/docs/docs/going-further/saving-queries.md +82 -0
- data/docs/docs/going-further/searching-postgres.md +57 -0
- data/docs/docs/going-further/wiki-contributors.md +82 -0
- data/docs/docs/intro.md +99 -0
- data/docs/docusaurus.config.js +120 -0
- data/docs/package.json +38 -0
- data/docs/sidebars.js +31 -0
- data/docs/src/components/HomepageFeatures/index.js +64 -0
- data/docs/src/components/HomepageFeatures/styles.module.css +11 -0
- data/docs/src/css/custom.css +39 -0
- data/docs/src/pages/index.module.css +23 -0
- data/docs/src/pages/markdown-page.md +7 -0
- 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 +1 -0
- 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 +171 -0
- data/docs/static/img/undraw_docusaurus_react.svg +170 -0
- data/docs/static/img/undraw_docusaurus_tree.svg +40 -0
- data/docs/static/logo/ransack-h.png +0 -0
- data/docs/static/logo/ransack-h.svg +34 -0
- data/docs/static/logo/ransack-v.png +0 -0
- data/docs/static/logo/ransack-v.svg +34 -0
- data/docs/static/logo/ransack.png +0 -0
- data/docs/static/logo/ransack.svg +21 -0
- data/docs/yarn.lock +8436 -0
- data/lib/polyamorous/activerecord_6.1_ruby_2/join_association.rb +70 -0
- data/lib/polyamorous/activerecord_6.1_ruby_2/join_dependency.rb +92 -0
- data/lib/polyamorous/activerecord_6.1_ruby_2/reflection.rb +11 -0
- data/lib/polyamorous/activerecord_7.0_ruby_2/join_association.rb +1 -0
- data/lib/polyamorous/activerecord_7.0_ruby_2/join_dependency.rb +1 -0
- data/lib/polyamorous/activerecord_7.0_ruby_2/reflection.rb +1 -0
- data/lib/polyamorous/activerecord_7.1_ruby_2/join_association.rb +1 -0
- data/lib/polyamorous/activerecord_7.1_ruby_2/join_dependency.rb +1 -0
- data/lib/polyamorous/activerecord_7.1_ruby_2/reflection.rb +1 -0
- data/lib/polyamorous/join.rb +70 -0
- data/lib/polyamorous/polyamorous.rb +24 -0
- data/lib/polyamorous/swapping_reflection_class.rb +11 -0
- data/lib/polyamorous/tree_node.rb +7 -0
- data/lib/polyamorous.rb +1 -0
- data/lib/ransack/adapters/active_record/base.rb +14 -3
- data/lib/ransack/adapters/active_record/context.rb +140 -196
- data/lib/ransack/adapters/active_record/ransack/constants.rb +19 -4
- data/lib/ransack/adapters/active_record/ransack/context.rb +9 -19
- data/lib/ransack/adapters/active_record/ransack/nodes/condition.rb +7 -7
- data/lib/ransack/adapters/active_record/ransack/translate.rb +1 -5
- data/lib/ransack/adapters/active_record/ransack/visitor.rb +23 -0
- data/lib/ransack/adapters/active_record.rb +0 -9
- data/lib/ransack/adapters.rb +2 -0
- data/lib/ransack/configuration.rb +52 -2
- data/lib/ransack/constants.rb +1 -5
- data/lib/ransack/context.rb +29 -24
- data/lib/ransack/helpers/form_builder.rb +12 -6
- data/lib/ransack/helpers/form_helper.rb +11 -3
- data/lib/ransack/helpers.rb +1 -1
- data/lib/ransack/locale/ar.yml +70 -0
- data/lib/ransack/locale/az.yml +70 -0
- data/lib/ransack/locale/bg.yml +70 -0
- data/lib/ransack/locale/ca.yml +70 -0
- data/lib/ransack/locale/el.yml +70 -0
- data/lib/ransack/locale/es.yml +22 -22
- data/lib/ransack/locale/fa.yml +70 -0
- data/lib/ransack/locale/fi.yml +71 -0
- data/lib/ransack/locale/nl.yml +4 -4
- data/lib/ransack/locale/ru.yml +70 -0
- data/lib/ransack/locale/sk.yml +70 -0
- data/lib/ransack/locale/sv.yml +70 -0
- data/lib/ransack/locale/tr.yml +70 -0
- data/lib/ransack/locale/zh-CN.yml +12 -12
- data/lib/ransack/nodes/attribute.rb +2 -2
- data/lib/ransack/nodes/condition.rb +7 -1
- data/lib/ransack/nodes/grouping.rb +3 -8
- data/lib/ransack/nodes/sort.rb +3 -3
- data/lib/ransack/nodes/value.rb +3 -3
- data/lib/ransack/predicate.rb +13 -20
- data/lib/ransack/search.rb +7 -4
- data/lib/ransack/translate.rb +115 -115
- data/lib/ransack/version.rb +1 -1
- data/lib/ransack/visitor.rb +1 -12
- data/lib/ransack.rb +7 -5
- data/ransack.gemspec +9 -25
- data/spec/blueprints/articles.rb +1 -1
- data/spec/blueprints/comments.rb +1 -1
- data/spec/blueprints/notes.rb +1 -1
- data/spec/blueprints/tags.rb +1 -1
- data/spec/console.rb +5 -5
- data/spec/helpers/polyamorous_helper.rb +13 -0
- data/spec/helpers/ransack_helper.rb +1 -1
- data/spec/polyamorous/activerecord_compatibility_spec.rb +15 -0
- data/spec/polyamorous/join_association_spec.rb +30 -0
- data/spec/polyamorous/join_dependency_spec.rb +81 -0
- data/spec/polyamorous/join_spec.rb +19 -0
- data/spec/ransack/adapters/active_record/base_spec.rb +105 -11
- data/spec/ransack/adapters/active_record/context_spec.rb +63 -24
- data/spec/ransack/configuration_spec.rb +24 -0
- data/spec/ransack/helpers/form_builder_spec.rb +3 -15
- data/spec/ransack/helpers/form_helper_spec.rb +135 -168
- data/spec/ransack/nodes/condition_spec.rb +13 -0
- data/spec/ransack/nodes/grouping_spec.rb +2 -2
- data/spec/ransack/nodes/value_spec.rb +115 -0
- data/spec/ransack/predicate_spec.rb +54 -2
- data/spec/ransack/search_spec.rb +266 -36
- data/spec/spec_helper.rb +14 -5
- data/spec/support/schema.rb +99 -21
- metadata +117 -187
- data/.travis.yml +0 -86
- data/lib/ransack/adapters/active_record/3.0/compat.rb +0 -179
- data/lib/ransack/adapters/active_record/3.0/context.rb +0 -203
- data/lib/ransack/adapters/active_record/3.1/context.rb +0 -212
- data/lib/ransack/adapters/active_record/3.2/context.rb +0 -44
- data/lib/ransack/adapters/active_record/compat.rb +0 -14
- data/lib/ransack/adapters/mongoid/attributes/attribute.rb +0 -37
- data/lib/ransack/adapters/mongoid/attributes/order_predications.rb +0 -17
- data/lib/ransack/adapters/mongoid/attributes/predications.rb +0 -141
- data/lib/ransack/adapters/mongoid/base.rb +0 -134
- data/lib/ransack/adapters/mongoid/context.rb +0 -212
- data/lib/ransack/adapters/mongoid/inquiry_hash.rb +0 -23
- data/lib/ransack/adapters/mongoid/ransack/constants.rb +0 -88
- data/lib/ransack/adapters/mongoid/ransack/context.rb +0 -60
- data/lib/ransack/adapters/mongoid/ransack/nodes/condition.rb +0 -27
- data/lib/ransack/adapters/mongoid/ransack/translate.rb +0 -13
- data/lib/ransack/adapters/mongoid/ransack/visitor.rb +0 -24
- data/lib/ransack/adapters/mongoid/table.rb +0 -35
- data/lib/ransack/adapters/mongoid.rb +0 -15
- data/spec/mongoid/adapters/mongoid/base_spec.rb +0 -314
- data/spec/mongoid/adapters/mongoid/context_spec.rb +0 -56
- data/spec/mongoid/configuration_spec.rb +0 -162
- data/spec/mongoid/dependencies_spec.rb +0 -8
- data/spec/mongoid/helpers/ransack_helper.rb +0 -11
- data/spec/mongoid/nodes/condition_spec.rb +0 -49
- data/spec/mongoid/nodes/grouping_spec.rb +0 -13
- data/spec/mongoid/predicate_spec.rb +0 -155
- data/spec/mongoid/search_spec.rb +0 -445
- data/spec/mongoid/support/mongoid.yml +0 -11
- data/spec/mongoid/support/schema.rb +0 -135
- data/spec/mongoid/translate_spec.rb +0 -14
- data/spec/mongoid_spec_helper.rb +0 -63
- data/spec/ransack/dependencies_spec.rb +0 -12
|
@@ -5,7 +5,27 @@ module Ransack
|
|
|
5
5
|
module Configuration
|
|
6
6
|
|
|
7
7
|
mattr_accessor :predicates, :options
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
class PredicateCollection
|
|
10
|
+
attr_reader :sorted_names_with_underscores
|
|
11
|
+
|
|
12
|
+
def initialize
|
|
13
|
+
@collection = {}
|
|
14
|
+
@sorted_names_with_underscores = []
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
delegate :[], :keys, :has_key?, to: :@collection
|
|
18
|
+
|
|
19
|
+
def []=(key, value)
|
|
20
|
+
@sorted_names_with_underscores << [key, '_' + key]
|
|
21
|
+
@sorted_names_with_underscores.sort! { |(a, _), (b, _)| b.length <=> a.length }
|
|
22
|
+
|
|
23
|
+
@collection[key] = value
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
self.predicates = PredicateCollection.new
|
|
28
|
+
|
|
9
29
|
self.options = {
|
|
10
30
|
:search_key => :q,
|
|
11
31
|
:ignore_unknown_conditions => true,
|
|
@@ -13,7 +33,9 @@ module Ransack
|
|
|
13
33
|
:up_arrow => '▼'.freeze,
|
|
14
34
|
:down_arrow => '▲'.freeze,
|
|
15
35
|
:default_arrow => nil,
|
|
16
|
-
:sanitize_scope_args => true
|
|
36
|
+
:sanitize_scope_args => true,
|
|
37
|
+
:postgres_fields_sort_option => nil,
|
|
38
|
+
:strip_whitespace => true
|
|
17
39
|
}
|
|
18
40
|
|
|
19
41
|
def configure
|
|
@@ -121,6 +143,21 @@ module Ransack
|
|
|
121
143
|
self.options[:sanitize_scope_args] = boolean
|
|
122
144
|
end
|
|
123
145
|
|
|
146
|
+
# The `NULLS FIRST` and `NULLS LAST` options can be used to determine
|
|
147
|
+
# whether nulls appear before or after non-null values in the sort ordering.
|
|
148
|
+
#
|
|
149
|
+
# User may want to configure it like this:
|
|
150
|
+
#
|
|
151
|
+
# Ransack.configure do |c|
|
|
152
|
+
# c.postgres_fields_sort_option = :nulls_first # or e.g. :nulls_always_last
|
|
153
|
+
# end
|
|
154
|
+
#
|
|
155
|
+
# See this feature: https://www.postgresql.org/docs/13/queries-order.html
|
|
156
|
+
#
|
|
157
|
+
def postgres_fields_sort_option=(setting)
|
|
158
|
+
self.options[:postgres_fields_sort_option] = setting
|
|
159
|
+
end
|
|
160
|
+
|
|
124
161
|
# By default, Ransack displays sort order indicator arrows in sort links.
|
|
125
162
|
# The default may be globally overridden in an initializer file like
|
|
126
163
|
# `config/initializers/ransack.rb` as follows:
|
|
@@ -134,6 +171,19 @@ module Ransack
|
|
|
134
171
|
self.options[:hide_sort_order_indicators] = boolean
|
|
135
172
|
end
|
|
136
173
|
|
|
174
|
+
# By default, Ransack displays strips all whitespace when searching for a string.
|
|
175
|
+
# The default may be globally changed in an initializer file like
|
|
176
|
+
# `config/initializers/ransack.rb` as follows:
|
|
177
|
+
#
|
|
178
|
+
# Ransack.configure do |config|
|
|
179
|
+
# # Enable whitespace stripping for string searches
|
|
180
|
+
# config.strip_whitespace = true
|
|
181
|
+
# end
|
|
182
|
+
#
|
|
183
|
+
def strip_whitespace=(boolean)
|
|
184
|
+
self.options[:strip_whitespace] = boolean
|
|
185
|
+
end
|
|
186
|
+
|
|
137
187
|
def arel_predicate_with_suffix(arel_predicate, suffix)
|
|
138
188
|
if arel_predicate === Proc
|
|
139
189
|
proc { |v| "#{arel_predicate.call(v)}#{suffix}" }
|
data/lib/ransack/constants.rb
CHANGED
|
@@ -36,7 +36,7 @@ module Ransack
|
|
|
36
36
|
'lt'.freeze, 'lteq'.freeze,
|
|
37
37
|
'gt'.freeze, 'gteq'.freeze,
|
|
38
38
|
'in'.freeze, 'not_in'.freeze
|
|
39
|
-
|
|
39
|
+
].freeze
|
|
40
40
|
A_S_I = ['a'.freeze, 's'.freeze, 'i'.freeze].freeze
|
|
41
41
|
|
|
42
42
|
EQ = 'eq'.freeze
|
|
@@ -45,11 +45,7 @@ module Ransack
|
|
|
45
45
|
NOT_EQ_ALL = 'not_eq_all'.freeze
|
|
46
46
|
CONT = 'cont'.freeze
|
|
47
47
|
|
|
48
|
-
RAILS_4_1 = '4.1'.freeze
|
|
49
|
-
RAILS_5_1 = '5.1'.freeze
|
|
50
|
-
|
|
51
48
|
RANSACK_SLASH_SEARCHES = 'ransack/searches'.freeze
|
|
52
49
|
RANSACK_SLASH_SEARCHES_SLASH_SEARCH = 'ransack/searches/search'.freeze
|
|
53
50
|
end
|
|
54
51
|
end
|
|
55
|
-
|
data/lib/ransack/context.rb
CHANGED
|
@@ -40,7 +40,7 @@ module Ransack
|
|
|
40
40
|
# Convert a string representing a chain of associations and an attribute
|
|
41
41
|
# into the attribute itself
|
|
42
42
|
def contextualize(str)
|
|
43
|
-
parent, attr_name =
|
|
43
|
+
parent, attr_name = bind_pair_for(str)
|
|
44
44
|
table_for(parent)[attr_name]
|
|
45
45
|
end
|
|
46
46
|
|
|
@@ -59,31 +59,33 @@ module Ransack
|
|
|
59
59
|
|
|
60
60
|
def bind(object, str)
|
|
61
61
|
return nil unless str
|
|
62
|
-
object.parent, object.attr_name =
|
|
62
|
+
object.parent, object.attr_name = bind_pair_for(str)
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
def traverse(str, base = @base)
|
|
66
66
|
str ||= ''.freeze
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
segments = str.split(Constants::UNDERSCORE)
|
|
68
|
+
unless segments.empty?
|
|
69
69
|
remainder = []
|
|
70
70
|
found_assoc = nil
|
|
71
|
-
|
|
71
|
+
until found_assoc || segments.empty?
|
|
72
72
|
# Strip the _of_Model_type text from the association name, but hold
|
|
73
73
|
# onto it in klass, for use as the next base
|
|
74
74
|
assoc, klass = unpolymorphize_association(
|
|
75
|
-
segments.join(
|
|
76
|
-
|
|
75
|
+
segments.join(Constants::UNDERSCORE)
|
|
76
|
+
)
|
|
77
77
|
if found_assoc = get_association(assoc, base)
|
|
78
78
|
base = traverse(
|
|
79
|
-
remainder.join(
|
|
80
|
-
|
|
79
|
+
remainder.join(Constants::UNDERSCORE), klass || found_assoc.klass
|
|
80
|
+
)
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
remainder.unshift segments.pop
|
|
84
84
|
end
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
unless found_assoc
|
|
86
|
+
raise(UntraversableAssociationError,
|
|
87
|
+
"No association matches #{str}")
|
|
88
|
+
end
|
|
87
89
|
end
|
|
88
90
|
|
|
89
91
|
klassify(base)
|
|
@@ -93,20 +95,19 @@ module Ransack
|
|
|
93
95
|
base = klassify(base)
|
|
94
96
|
str ||= ''.freeze
|
|
95
97
|
path = []
|
|
96
|
-
segments = str.split(
|
|
98
|
+
segments = str.split(Constants::UNDERSCORE)
|
|
97
99
|
association_parts = []
|
|
98
|
-
|
|
99
|
-
while segments.
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
unless segments.empty?
|
|
101
|
+
while !segments.empty? &&
|
|
102
|
+
!base.columns_hash[segments.join(Constants::UNDERSCORE)] &&
|
|
103
|
+
association_parts << segments.shift
|
|
102
104
|
assoc, klass = unpolymorphize_association(
|
|
103
105
|
association_parts.join(Constants::UNDERSCORE)
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
end
|
|
106
|
+
)
|
|
107
|
+
next unless found_assoc = get_association(assoc, base)
|
|
108
|
+
path += association_parts
|
|
109
|
+
association_parts = []
|
|
110
|
+
base = klassify(klass || found_assoc)
|
|
110
111
|
end
|
|
111
112
|
end
|
|
112
113
|
|
|
@@ -127,7 +128,7 @@ module Ransack
|
|
|
127
128
|
|
|
128
129
|
def ransackable_attribute?(str, klass)
|
|
129
130
|
klass.ransackable_attributes(auth_object).include?(str) ||
|
|
130
|
-
|
|
131
|
+
klass.ransortable_attributes(auth_object).include?(str)
|
|
131
132
|
end
|
|
132
133
|
|
|
133
134
|
def ransackable_association?(str, klass)
|
|
@@ -135,7 +136,11 @@ module Ransack
|
|
|
135
136
|
end
|
|
136
137
|
|
|
137
138
|
def ransackable_scope?(str, klass)
|
|
138
|
-
klass.ransackable_scopes(auth_object).any? { |s| s.
|
|
139
|
+
klass.ransackable_scopes(auth_object).any? { |s| s.to_sym == str.to_sym }
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def ransackable_scope_skip_sanitize_args?(str, klass)
|
|
143
|
+
klass.ransackable_scopes_skip_sanitize_args.any? { |s| s.to_sym == str.to_sym }
|
|
139
144
|
end
|
|
140
145
|
|
|
141
146
|
def searchable_attributes(str = ''.freeze)
|
|
@@ -6,8 +6,14 @@ module ActionView::Helpers::Tags
|
|
|
6
6
|
# https://github.com/rails/rails/commit/c1a118a
|
|
7
7
|
class Base
|
|
8
8
|
private
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
if defined? ::ActiveRecord
|
|
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
|
|
15
|
+
end
|
|
16
|
+
end
|
|
11
17
|
end
|
|
12
18
|
end
|
|
13
19
|
end
|
|
@@ -39,9 +45,9 @@ module Ransack
|
|
|
39
45
|
end
|
|
40
46
|
|
|
41
47
|
def attribute_select(options = nil, html_options = nil, action = nil)
|
|
42
|
-
options
|
|
43
|
-
html_options
|
|
44
|
-
action
|
|
48
|
+
options ||= {}
|
|
49
|
+
html_options ||= {}
|
|
50
|
+
action ||= Constants::SEARCH
|
|
45
51
|
default = options.delete(:default)
|
|
46
52
|
raise ArgumentError, formbuilder_error_message(
|
|
47
53
|
"#{action}_select") unless object.respond_to?(:context)
|
|
@@ -237,7 +243,7 @@ module Ransack
|
|
|
237
243
|
Translate.association(base, :context => object.context),
|
|
238
244
|
collection_for_base(action, base)
|
|
239
245
|
]
|
|
240
|
-
rescue UntraversableAssociationError
|
|
246
|
+
rescue UntraversableAssociationError
|
|
241
247
|
nil
|
|
242
248
|
end
|
|
243
249
|
end
|
|
@@ -130,12 +130,20 @@ module Ransack
|
|
|
130
130
|
|
|
131
131
|
def url_options
|
|
132
132
|
@params.merge(
|
|
133
|
-
@options.merge(
|
|
133
|
+
@options.except(:class, :data, :host).merge(
|
|
134
134
|
@search.context.search_key => search_and_sort_params))
|
|
135
135
|
end
|
|
136
136
|
|
|
137
137
|
def html_options(args)
|
|
138
|
-
|
|
138
|
+
if args.empty?
|
|
139
|
+
html_options = @options
|
|
140
|
+
else
|
|
141
|
+
deprecation_message = "Passing two trailing hashes to `sort_link` is deprecated, merge the trailing hashes into a single one."
|
|
142
|
+
caller_location = caller_locations(2, 2).first
|
|
143
|
+
warn "#{deprecation_message} (called at #{caller_location.path}:#{caller_location.lineno})"
|
|
144
|
+
html_options = extract_options_and_mutate_args!(args)
|
|
145
|
+
end
|
|
146
|
+
|
|
139
147
|
html_options.merge(
|
|
140
148
|
class: [['sort_link'.freeze, @current_dir], html_options[:class]]
|
|
141
149
|
.compact.join(' '.freeze)
|
|
@@ -145,7 +153,7 @@ module Ransack
|
|
|
145
153
|
private
|
|
146
154
|
|
|
147
155
|
def parameters_hash(params)
|
|
148
|
-
if
|
|
156
|
+
if params.respond_to?(:to_unsafe_h)
|
|
149
157
|
params.to_unsafe_h
|
|
150
158
|
else
|
|
151
159
|
params
|
data/lib/ransack/helpers.rb
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
require 'ransack/helpers/form_builder'
|
|
2
|
-
require 'ransack/helpers/form_helper'
|
|
2
|
+
require 'ransack/helpers/form_helper'
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
ar:
|
|
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,70 @@
|
|
|
1
|
+
az:
|
|
2
|
+
ransack:
|
|
3
|
+
search: "axtar"
|
|
4
|
+
predicate: "təsdiqlə"
|
|
5
|
+
and: "və"
|
|
6
|
+
or: "və ya"
|
|
7
|
+
any: "hər hansı"
|
|
8
|
+
all: "hamısı"
|
|
9
|
+
combinator: "birləşdirici"
|
|
10
|
+
attribute: "xüsusiyyət"
|
|
11
|
+
value: "dəyər"
|
|
12
|
+
condition: "şərt"
|
|
13
|
+
sort: "sırala"
|
|
14
|
+
asc: "artan"
|
|
15
|
+
desc: "azalan"
|
|
16
|
+
predicates:
|
|
17
|
+
eq: "bərabər"
|
|
18
|
+
eq_any: "hər hansı birinə bərabər"
|
|
19
|
+
eq_all: "hamısına bərabər"
|
|
20
|
+
not_eq: "bərabər deyil"
|
|
21
|
+
not_eq_any: "hər hansı birinə bərabər deyil"
|
|
22
|
+
not_eq_all: "heç birinə bərabər deyil"
|
|
23
|
+
matches: "uyğunlaşan"
|
|
24
|
+
matches_any: "hər hansı biri ilə uyğunlaşan"
|
|
25
|
+
matches_all: "hamısı ilə uyğunlaşan"
|
|
26
|
+
does_not_match: "uyğunlaşmayan"
|
|
27
|
+
does_not_match_any: "hər hansı biri ilə uyğunlaşmayan"
|
|
28
|
+
does_not_match_all: "heç biri ilə uyğunlaşmayan"
|
|
29
|
+
lt: "daha kiçik"
|
|
30
|
+
lt_any: "hər hansı birindən kiçik"
|
|
31
|
+
lt_all: "hamısından kiçik"
|
|
32
|
+
lteq: "daha kiçik və ya bərabər"
|
|
33
|
+
lteq_any: "daha kiçik və ya hər hansı birinə bərabər"
|
|
34
|
+
lteq_all: "daha kiçik və ya hamısına bərabər"
|
|
35
|
+
gt: "daha böyük "
|
|
36
|
+
gt_any: "hər hansı birindən daha böyük"
|
|
37
|
+
gt_all: "hamısından daha böyük"
|
|
38
|
+
gteq: "daha böyük və ya bərabər"
|
|
39
|
+
gteq_any: "daha böyük və ya hər hansı birine bərabər"
|
|
40
|
+
gteq_all: "daha böyük və ya hamısıne bərabər"
|
|
41
|
+
in: "içində"
|
|
42
|
+
in_any: "hər hansı birində"
|
|
43
|
+
in_all: "hamısında"
|
|
44
|
+
not_in: "içində deyil"
|
|
45
|
+
not_in_any: "hər hansı birində deyil"
|
|
46
|
+
not_in_all: "heç birində deyil"
|
|
47
|
+
cont: "ehtiva edən"
|
|
48
|
+
cont_any: "hər hansı birini ehtiva edən"
|
|
49
|
+
cont_all: "hamısını ehtiva edən"
|
|
50
|
+
not_cont: "ehtiva etməyən"
|
|
51
|
+
not_cont_any: "hər hansı birini ehtiva etməyən"
|
|
52
|
+
not_cont_all: "heç birini birini ehtiva etməyən"
|
|
53
|
+
start: "ilə başlayan"
|
|
54
|
+
start_any: "hər hansı biri ilə başlayan"
|
|
55
|
+
start_all: "hamısı ilə başlayan"
|
|
56
|
+
not_start: "ilə başlamayan"
|
|
57
|
+
not_start_any: "hər hansı biri ilə başlamayan"
|
|
58
|
+
not_start_all: "hiçbiri ilə başlamayan"
|
|
59
|
+
end: "ilə bitən"
|
|
60
|
+
end_any: "hər hansı biri ilə bitən"
|
|
61
|
+
end_all: "hamısı ilə bitən"
|
|
62
|
+
not_end: "ilə bitməyən"
|
|
63
|
+
not_end_any: "hər hansı biri ilə bitməyən"
|
|
64
|
+
not_end_all: "heç biri ilə bitməyən"
|
|
65
|
+
'true': "doğru"
|
|
66
|
+
'false': "yanlış"
|
|
67
|
+
present: "mövcüd"
|
|
68
|
+
blank: "boş"
|
|
69
|
+
'null': "keçərsiz"
|
|
70
|
+
not_null: "keçərli"
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
bg:
|
|
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,70 @@
|
|
|
1
|
+
ca:
|
|
2
|
+
ransack:
|
|
3
|
+
search: "cercar"
|
|
4
|
+
predicate: "predicat"
|
|
5
|
+
and: "i"
|
|
6
|
+
or: "o"
|
|
7
|
+
any: "qualsevol"
|
|
8
|
+
all: "tots"
|
|
9
|
+
combinator: "combinador"
|
|
10
|
+
attribute: "atribut"
|
|
11
|
+
value: "valor"
|
|
12
|
+
condition: "condició"
|
|
13
|
+
sort: "ordenar"
|
|
14
|
+
asc: "ascendent"
|
|
15
|
+
desc: "descendent"
|
|
16
|
+
predicates:
|
|
17
|
+
eq: "és igual a"
|
|
18
|
+
eq_any: "és igual a qualsevol"
|
|
19
|
+
eq_all: "és igual a tots"
|
|
20
|
+
not_eq: "no és igual a"
|
|
21
|
+
not_eq_any: "no és igual a qualsevol"
|
|
22
|
+
not_eq_all: "no és igual a tots"
|
|
23
|
+
matches: "coincideix"
|
|
24
|
+
matches_any: "coincideix a qualsevol"
|
|
25
|
+
matches_all: "coincideix a tots"
|
|
26
|
+
does_not_match: "no coincideix"
|
|
27
|
+
does_not_match_any: "no coincideix amb cap"
|
|
28
|
+
does_not_match_all: "no coincideix amb tots"
|
|
29
|
+
lt: "menor que"
|
|
30
|
+
lt_any: "menor que qualsevol"
|
|
31
|
+
lt_all: "menor o igual a"
|
|
32
|
+
lteq: "menor que o igual a"
|
|
33
|
+
lteq_any: "menor o igual a qualsevol"
|
|
34
|
+
lteq_all: "menor o igual a tots"
|
|
35
|
+
gt: "major que"
|
|
36
|
+
gt_any: "major que qualsevol"
|
|
37
|
+
gt_all: "major que tots"
|
|
38
|
+
gteq: "major que o igual a"
|
|
39
|
+
gteq_any: "major que o igual a qualsevol"
|
|
40
|
+
gteq_all: "major que o igual a tots"
|
|
41
|
+
in: "en"
|
|
42
|
+
in_any: "en qualsevol"
|
|
43
|
+
in_all: "en tots"
|
|
44
|
+
not_in: "no en"
|
|
45
|
+
not_in_any: "no en qualsevol"
|
|
46
|
+
not_in_all: "no en tots"
|
|
47
|
+
cont: "conté"
|
|
48
|
+
cont_any: "conté qualsevol"
|
|
49
|
+
cont_all: "conté tots"
|
|
50
|
+
not_cont: "no conté"
|
|
51
|
+
not_cont_any: "no conté cap"
|
|
52
|
+
not_cont_all: "no conté tota"
|
|
53
|
+
start: "comença per"
|
|
54
|
+
start_any: "comença per qualsevol"
|
|
55
|
+
start_all: "comença per tot"
|
|
56
|
+
not_start: "no comença per"
|
|
57
|
+
not_start_any: "no comença per qualsevol"
|
|
58
|
+
not_start_all: "no comença per tot"
|
|
59
|
+
end: "acaba en"
|
|
60
|
+
end_any: "acaba en qualsevol"
|
|
61
|
+
end_all: "acaba en tot"
|
|
62
|
+
not_end: "no acaba en"
|
|
63
|
+
not_end_any: "no acaba en qualsevol"
|
|
64
|
+
not_end_all: "no acaba en tot"
|
|
65
|
+
'true': "és verdader"
|
|
66
|
+
'false': "és fals"
|
|
67
|
+
present: "és present"
|
|
68
|
+
blank: "està en blanc"
|
|
69
|
+
'null': "és nul"
|
|
70
|
+
not_null: "no és nul"
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
el:
|
|
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: "δεν είναι άκυρο"
|