ransack 2.1.1 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +3 -0
- data/.github/SECURITY.md +12 -0
- data/.github/workflows/cronjob.yml +102 -0
- data/.github/workflows/rubocop.yml +20 -0
- data/.github/workflows/test.yml +163 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +44 -0
- data/CHANGELOG.md +64 -1
- data/CONTRIBUTING.md +16 -11
- data/Gemfile +23 -17
- data/README.md +190 -57
- 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/img/create_release.png +0 -0
- data/docs/release_process.md +17 -0
- data/lib/polyamorous/{activerecord_5.2.1_ruby_2 → activerecord_5.2_ruby_2}/join_association.rb +2 -9
- data/lib/polyamorous/{activerecord_5.2.1_ruby_2 → activerecord_5.2_ruby_2}/join_dependency.rb +25 -3
- data/lib/polyamorous/activerecord_5.2_ruby_2/reflection.rb +11 -0
- data/lib/polyamorous/activerecord_6.0_ruby_2/join_association.rb +1 -0
- data/lib/polyamorous/activerecord_6.0_ruby_2/join_dependency.rb +80 -0
- data/lib/polyamorous/activerecord_6.0_ruby_2/reflection.rb +1 -0
- data/lib/polyamorous/activerecord_6.1_ruby_2/join_association.rb +74 -0
- data/lib/polyamorous/activerecord_6.1_ruby_2/join_dependency.rb +93 -0
- data/lib/polyamorous/activerecord_6.1_ruby_2/reflection.rb +1 -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/polyamorous.rb +24 -0
- data/lib/polyamorous.rb +1 -25
- data/lib/ransack/adapters/active_record/base.rb +5 -1
- data/lib/ransack/adapters/active_record/context.rb +71 -68
- data/lib/ransack/adapters/active_record/ransack/constants.rb +18 -3
- data/lib/ransack/adapters/active_record/ransack/context.rb +2 -6
- data/lib/ransack/adapters/active_record/ransack/nodes/condition.rb +13 -5
- data/lib/ransack/adapters/active_record/ransack/translate.rb +1 -1
- data/lib/ransack/configuration.rb +31 -1
- data/lib/ransack/constants.rb +3 -5
- data/lib/ransack/context.rb +19 -18
- data/lib/ransack/helpers/form_builder.rb +8 -14
- data/lib/ransack/helpers/form_helper.rb +1 -1
- data/lib/ransack/helpers.rb +1 -1
- data/lib/ransack/locale/az.yml +1 -1
- data/lib/ransack/locale/ca.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/sk.yml +70 -0
- data/lib/ransack/locale/sv.yml +70 -0
- data/lib/ransack/nodes/attribute.rb +1 -1
- data/lib/ransack/nodes/condition.rb +7 -1
- data/lib/ransack/nodes/grouping.rb +1 -1
- data/lib/ransack/nodes/sort.rb +3 -3
- data/lib/ransack/nodes/value.rb +1 -1
- data/lib/ransack/predicate.rb +2 -1
- data/lib/ransack/search.rb +4 -1
- data/lib/ransack/translate.rb +115 -115
- data/lib/ransack/version.rb +1 -1
- data/lib/ransack.rb +3 -3
- data/ransack.gemspec +8 -23
- 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 +3 -8
- data/spec/helpers/ransack_helper.rb +1 -1
- data/spec/{ransack → polyamorous}/join_association_spec.rb +8 -1
- data/spec/{ransack → polyamorous}/join_dependency_spec.rb +18 -7
- data/spec/{ransack → polyamorous}/join_spec.rb +0 -0
- data/spec/ransack/adapters/active_record/base_spec.rb +26 -15
- data/spec/ransack/adapters/active_record/context_spec.rb +60 -18
- data/spec/ransack/configuration_spec.rb +24 -0
- data/spec/ransack/helpers/form_helper_spec.rb +16 -16
- data/spec/ransack/nodes/condition_spec.rb +13 -0
- data/spec/ransack/nodes/grouping_spec.rb +2 -2
- data/spec/ransack/predicate_spec.rb +54 -2
- data/spec/ransack/search_spec.rb +238 -36
- data/spec/spec_helper.rb +10 -5
- data/spec/support/schema.rb +37 -3
- metadata +45 -139
- data/.travis.yml +0 -37
- data/lib/polyamorous/activerecord_5.0_ruby_2/join_association.rb +0 -2
- data/lib/polyamorous/activerecord_5.0_ruby_2/join_dependency.rb +0 -2
- data/lib/polyamorous/activerecord_5.1_ruby_2/join_association.rb +0 -32
- data/lib/polyamorous/activerecord_5.1_ruby_2/join_dependency.rb +0 -112
- data/lib/polyamorous/activerecord_5.2.0_ruby_2/join_association.rb +0 -32
- data/lib/polyamorous/activerecord_5.2.0_ruby_2/join_dependency.rb +0 -113
data/lib/ransack/context.rb
CHANGED
@@ -64,26 +64,28 @@ module Ransack
|
|
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
75
|
segments.join(Constants::UNDERSCORE)
|
76
|
-
|
76
|
+
)
|
77
77
|
if found_assoc = get_association(assoc, base)
|
78
78
|
base = traverse(
|
79
79
|
remainder.join(Constants::UNDERSCORE), klass || found_assoc.klass
|
80
|
-
|
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)
|
@@ -95,18 +97,17 @@ module Ransack
|
|
95
97
|
path = []
|
96
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)
|
@@ -7,17 +7,11 @@ module ActionView::Helpers::Tags
|
|
7
7
|
class Base
|
8
8
|
private
|
9
9
|
if defined? ::ActiveRecord
|
10
|
-
|
11
|
-
|
12
|
-
object.send @method_name if object
|
13
|
-
|
14
|
-
|
15
|
-
def value
|
16
|
-
if @allow_method_names_outside_object
|
17
|
-
object.send @method_name if object && object.respond_to?(@method_name, true)
|
18
|
-
else
|
19
|
-
object.send @method_name if object
|
20
|
-
end
|
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
|
21
15
|
end
|
22
16
|
end
|
23
17
|
end
|
@@ -51,9 +45,9 @@ module Ransack
|
|
51
45
|
end
|
52
46
|
|
53
47
|
def attribute_select(options = nil, html_options = nil, action = nil)
|
54
|
-
options
|
55
|
-
html_options
|
56
|
-
action
|
48
|
+
options ||= {}
|
49
|
+
html_options ||= {}
|
50
|
+
action ||= Constants::SEARCH
|
57
51
|
default = options.delete(:default)
|
58
52
|
raise ArgumentError, formbuilder_error_message(
|
59
53
|
"#{action}_select") unless object.respond_to?(:context)
|
@@ -145,7 +145,7 @@ module Ransack
|
|
145
145
|
private
|
146
146
|
|
147
147
|
def parameters_hash(params)
|
148
|
-
if ::ActiveRecord::VERSION::MAJOR
|
148
|
+
if ::ActiveRecord::VERSION::MAJOR >= 5 && params.respond_to?(:to_unsafe_h)
|
149
149
|
params.to_unsafe_h
|
150
150
|
else
|
151
151
|
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'
|
data/lib/ransack/locale/az.yml
CHANGED
@@ -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"
|
data/lib/ransack/locale/es.yml
CHANGED
@@ -6,11 +6,11 @@ es:
|
|
6
6
|
or: "o"
|
7
7
|
any: "cualquier"
|
8
8
|
all: "todos"
|
9
|
-
combinator: "
|
9
|
+
combinator: "combinador"
|
10
10
|
attribute: "atributo"
|
11
11
|
value: "valor"
|
12
12
|
condition: "condición"
|
13
|
-
sort: "
|
13
|
+
sort: "ordenar"
|
14
14
|
asc: "ascendente"
|
15
15
|
desc: "descendente"
|
16
16
|
predicates:
|
@@ -19,12 +19,12 @@ es:
|
|
19
19
|
eq_all: "es igual a todos"
|
20
20
|
not_eq: "no es igual a"
|
21
21
|
not_eq_any: "no es igual a cualquier"
|
22
|
-
not_eq_all: "no es
|
23
|
-
matches: "
|
24
|
-
matches_any: "
|
25
|
-
matches_all: "
|
26
|
-
does_not_match: "no coincide"
|
27
|
-
does_not_match_any: "no coincide con
|
22
|
+
not_eq_all: "no es igual a todos"
|
23
|
+
matches: "coincide con"
|
24
|
+
matches_any: "coincide con cualquier"
|
25
|
+
matches_all: "coincide con todos"
|
26
|
+
does_not_match: "no coincide con"
|
27
|
+
does_not_match_any: "no coincide con ninguno"
|
28
28
|
does_not_match_all: "no coincide con todos"
|
29
29
|
lt: "menor que"
|
30
30
|
lt_any: "menor que cualquier"
|
@@ -48,23 +48,23 @@ es:
|
|
48
48
|
cont_any: "contiene cualquier"
|
49
49
|
cont_all: "contiene todos"
|
50
50
|
not_cont: "no contiene"
|
51
|
-
not_cont_any: "no contiene
|
52
|
-
not_cont_all: "no contiene
|
51
|
+
not_cont_any: "no contiene ninguno"
|
52
|
+
not_cont_all: "no contiene todos"
|
53
53
|
start: "comienza con"
|
54
54
|
start_any: "comienza con cualquier"
|
55
|
-
start_all: "comienza con
|
56
|
-
not_start: "no
|
55
|
+
start_all: "comienza con todos"
|
56
|
+
not_start: "no comienza con"
|
57
57
|
not_start_any: "no comienza con cualquier"
|
58
|
-
not_start_all: "no
|
59
|
-
end: "termina
|
60
|
-
end_any: "termina
|
61
|
-
end_all: "termina
|
62
|
-
not_end: "no termina
|
63
|
-
not_end_any: "no termina
|
64
|
-
not_end_all: "no termina
|
58
|
+
not_start_all: "no comienza con todos"
|
59
|
+
end: "termina en"
|
60
|
+
end_any: "termina en cualquier"
|
61
|
+
end_all: "termina en todos"
|
62
|
+
not_end: "no termina en"
|
63
|
+
not_end_any: "no termina en cualquier"
|
64
|
+
not_end_all: "no termina en todos"
|
65
65
|
'true': "es verdadero"
|
66
66
|
'false': "es falso"
|
67
|
-
present: "
|
67
|
+
present: "está presente"
|
68
68
|
blank: "está en blanco"
|
69
|
-
'null': "es
|
70
|
-
not_null: "no es
|
69
|
+
'null': "es nulo"
|
70
|
+
not_null: "no es nulo"
|
@@ -0,0 +1,70 @@
|
|
1
|
+
fa:
|
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,71 @@
|
|
1
|
+
fi:
|
2
|
+
ransack:
|
3
|
+
search: "haku"
|
4
|
+
predicate: "predikaatti"
|
5
|
+
and: "ja"
|
6
|
+
or: "tai"
|
7
|
+
any: "jokin"
|
8
|
+
all: "kaikki"
|
9
|
+
combinator: "kombinaattori"
|
10
|
+
attribute: "attribuutti"
|
11
|
+
value: "arvo"
|
12
|
+
condition: "ehto"
|
13
|
+
sort: "järjestys"
|
14
|
+
asc: "nouseva"
|
15
|
+
desc: "laskeva"
|
16
|
+
predicates:
|
17
|
+
eq: "sama kuin"
|
18
|
+
eq_any: "sama kuin jokin"
|
19
|
+
eq_all: "sama kuin kaikki"
|
20
|
+
not_eq: "eri kuin"
|
21
|
+
not_eq_any: "eri kuin jokin"
|
22
|
+
not_eq_all: "eri kuin kaikki"
|
23
|
+
matches: "täsmää"
|
24
|
+
matches_any: "täsmää jonkun kanssa"
|
25
|
+
matches_all: "täsmää kaikkien kanssa"
|
26
|
+
does_not_match: "ei täsmää"
|
27
|
+
does_not_match_any: "ei täsmää minkään kanssa"
|
28
|
+
does_not_match_all: "ei täsmää kaikkien kanssa"
|
29
|
+
lt: "vähemmän kuin"
|
30
|
+
lt_any: "vähemmän kuin jokin"
|
31
|
+
lt_all: "vähemmän kuin mikään"
|
32
|
+
lteq: "vähemmän tai sama kuin"
|
33
|
+
lteq_any: "vähemmän tai sama kuin jokin"
|
34
|
+
lteq_all: "vähemmän tai sama kuin mikään"
|
35
|
+
gt: "suurempi kuin"
|
36
|
+
gt_any: "suurempi kuin jokin"
|
37
|
+
gt_all: "suurempi kuin mikään"
|
38
|
+
gteq: "suurempi tai yhtä suuri kuin"
|
39
|
+
gteq_any: "suurempi tai yhtä suuri kuin jokin"
|
40
|
+
gteq_all: "suurempi tai yhtä suuri kuin mikään"
|
41
|
+
in: "kohteessa"
|
42
|
+
in_any: "jossakin kohteessa"
|
43
|
+
in_all: "kaikissa kohteissa"
|
44
|
+
not_in: "ei kohteessa"
|
45
|
+
not_in_any: "ei jossakin kohteista"
|
46
|
+
not_in_all: "ei missään kohteista"
|
47
|
+
cont: "sisältää"
|
48
|
+
cont_any: "sisältää jonkin"
|
49
|
+
cont_all: "sisältää kaikki"
|
50
|
+
not_cont: "ei sisällä"
|
51
|
+
not_cont_any: "ei sisällä jotakin"
|
52
|
+
not_cont_all: "ei sisällä mitään"
|
53
|
+
start: "alkaa"
|
54
|
+
start_any: "alkaa jollakin"
|
55
|
+
start_all: "alkaa kaikilla"
|
56
|
+
not_start: "ei ala"
|
57
|
+
not_start_any: "ei ala jollakin"
|
58
|
+
not_start_all: "ei ala millään"
|
59
|
+
end: "päättyy"
|
60
|
+
end_any: "päättyy jollakin"
|
61
|
+
end_all: "päättyy millään"
|
62
|
+
not_end: "ei pääty"
|
63
|
+
not_end_any: "ei pääty jollakin"
|
64
|
+
not_end_all: "ei pääty millään"
|
65
|
+
'true': "on tosi"
|
66
|
+
'false': "ei ole tosi"
|
67
|
+
present: "on läsnä"
|
68
|
+
blank: "on tyhjä"
|
69
|
+
'null': "on määrittämätön"
|
70
|
+
not_null: "on määritetty"
|
71
|
+
|
@@ -0,0 +1,70 @@
|
|
1
|
+
sk:
|
2
|
+
ransack:
|
3
|
+
search: "vyhľadávanie"
|
4
|
+
predicate: "predikát"
|
5
|
+
and: "a"
|
6
|
+
or: "alebo"
|
7
|
+
any: "akýkoľvek"
|
8
|
+
all: "každý"
|
9
|
+
combinator: "kombinátor"
|
10
|
+
attribute: "atribút"
|
11
|
+
value: "hodnota"
|
12
|
+
condition: "podmienka"
|
13
|
+
sort: "poradie"
|
14
|
+
asc: "vzostupne"
|
15
|
+
desc: "zostupne"
|
16
|
+
predicates:
|
17
|
+
eq: "sa rovná"
|
18
|
+
eq_any: "sa rovná akémukoľvek"
|
19
|
+
eq_all: "sa rovná všetkým"
|
20
|
+
not_eq: "sa nerovná"
|
21
|
+
not_eq_any: "sa nerovná akémukoľvek"
|
22
|
+
not_eq_all: "sa nerovná všetkým"
|
23
|
+
matches: "zodpovedá"
|
24
|
+
matches_any: "zodpovedá akémukoľvek"
|
25
|
+
matches_all: "zodpovedá všetkým"
|
26
|
+
does_not_match: "nezodpovedá"
|
27
|
+
does_not_match_any: "nezodpovedá akémukoľvek"
|
28
|
+
does_not_match_all: "nezodpovedá všetkým"
|
29
|
+
lt: "menší ako"
|
30
|
+
lt_any: "menší ako akýkoľvek"
|
31
|
+
lt_all: "menší ako všetky"
|
32
|
+
lteq: "menší alebo rovný"
|
33
|
+
lteq_any: "menší alebo rovný akémukoľvek"
|
34
|
+
lteq_all: "menší alebo rovný všetkým"
|
35
|
+
gt: "väčší ako"
|
36
|
+
gt_any: "väčší ako akýkoľvek"
|
37
|
+
gt_all: "väčší ako všetky"
|
38
|
+
gteq: "väčší alebo rovný"
|
39
|
+
gteq_any: "väčší alebo rovný akémukoľvek"
|
40
|
+
gteq_all: "väčší alebo rovný všetkým"
|
41
|
+
in: "v"
|
42
|
+
in_any: "v akejkoľvek"
|
43
|
+
in_all: "vo všetkých"
|
44
|
+
not_in: "nie je v"
|
45
|
+
not_in_any: "nie je v akejkoľvek"
|
46
|
+
not_in_all: "nie je vo všetkých"
|
47
|
+
cont: "obsahuje"
|
48
|
+
cont_any: "obsahuje akúkoľvek"
|
49
|
+
cont_all: "obsahuje všetky"
|
50
|
+
not_cont: "neobsahuje"
|
51
|
+
not_cont_any: "neobsahuje akúkoľvek"
|
52
|
+
not_cont_all: "neobsahuje všetky"
|
53
|
+
start: "začína na"
|
54
|
+
start_any: "začína s akoukoľvek"
|
55
|
+
start_all: "začína so všetkými"
|
56
|
+
not_start: "nezačíná s"
|
57
|
+
not_start_any: "nezačíná s akoukoľvek"
|
58
|
+
not_start_all: "nezačíná so všetkými"
|
59
|
+
end: "končí s"
|
60
|
+
end_any: "končí s akoukoľvek"
|
61
|
+
end_all: "končí so všetkými"
|
62
|
+
not_end: "nekončí s"
|
63
|
+
not_end_any: "nekončí s akoukoľvek"
|
64
|
+
not_end_all: "nekončí so všetkými"
|
65
|
+
'true': "je pravdivé"
|
66
|
+
'false': "nie je pravdivé"
|
67
|
+
present: "je vyplnené"
|
68
|
+
blank: "je prázdne"
|
69
|
+
'null': "je null"
|
70
|
+
not_null: "nie je null"
|
@@ -0,0 +1,70 @@
|
|
1
|
+
sv:
|
2
|
+
ransack:
|
3
|
+
search: "sök"
|
4
|
+
predicate: "predikat"
|
5
|
+
and: "och"
|
6
|
+
or: "eller"
|
7
|
+
any: "vilken som"
|
8
|
+
all: "alla"
|
9
|
+
combinator: "kombinator"
|
10
|
+
attribute: "attribut"
|
11
|
+
value: "värde"
|
12
|
+
condition: "villkor"
|
13
|
+
sort: "sortera"
|
14
|
+
asc: "stigande"
|
15
|
+
desc: "fallande"
|
16
|
+
predicates:
|
17
|
+
eq: "lika med"
|
18
|
+
eq_any: "lika med vilket som"
|
19
|
+
eq_all: "lika med alla"
|
20
|
+
not_eq: "inte lika med"
|
21
|
+
not_eq_any: "inte lika med någon"
|
22
|
+
not_eq_all: "inte lika med alla"
|
23
|
+
matches: "matchar"
|
24
|
+
matches_any: "matchar någon"
|
25
|
+
matches_all: "matchar alla"
|
26
|
+
does_not_match: "matchar inte"
|
27
|
+
does_not_match_any: "matchar inte någon"
|
28
|
+
does_not_match_all: "matchar inte alla"
|
29
|
+
lt: "mindre än"
|
30
|
+
lt_any: "mindre än någon"
|
31
|
+
lt_all: "mindre än alla"
|
32
|
+
lteq: "mindre än eller lika med"
|
33
|
+
lteq_any: "mindre än eller lika med någon"
|
34
|
+
lteq_all: "mindre än eller lika med alla"
|
35
|
+
gt: "större än"
|
36
|
+
gt_any: "större än någon"
|
37
|
+
gt_all: "större än alla"
|
38
|
+
gteq: "större än eller lika med"
|
39
|
+
gteq_any: "större än eller lika med någon"
|
40
|
+
gteq_all: "större än eller lika med alla"
|
41
|
+
in: "i"
|
42
|
+
in_any: "i någon"
|
43
|
+
in_all: "i alla"
|
44
|
+
not_in: "inte i"
|
45
|
+
not_in_any: "inte i någon"
|
46
|
+
not_in_all: "inte i alla"
|
47
|
+
cont: "innehåller"
|
48
|
+
cont_any: "innehåller någon"
|
49
|
+
cont_all: "innehåller alla"
|
50
|
+
not_cont: "innehåller inte"
|
51
|
+
not_cont_any: "innehåller inte någon"
|
52
|
+
not_cont_all: "innehåller inte alla"
|
53
|
+
start: "börjar med"
|
54
|
+
start_any: "börjar med någon"
|
55
|
+
start_all: "börjar med alla"
|
56
|
+
not_start: "börjar inte med"
|
57
|
+
not_start_any: "börjar inte med någon"
|
58
|
+
not_start_all: "börjar inte med alla"
|
59
|
+
end: "slutar med"
|
60
|
+
end_any: "slutar med någon"
|
61
|
+
end_all: "slutar med alla"
|
62
|
+
not_end: "slutar inte med"
|
63
|
+
not_end_any: "slutar inte med någon"
|
64
|
+
not_end_all: "slutar inte med alla"
|
65
|
+
'true': "är sant"
|
66
|
+
'false': "är falskt"
|
67
|
+
present: "existerar"
|
68
|
+
blank: "är tom"
|
69
|
+
'null': "är null"
|
70
|
+
not_null: "är inte null"
|
@@ -127,7 +127,6 @@ module Ransack
|
|
127
127
|
alias :m= :combinator=
|
128
128
|
alias :m :combinator
|
129
129
|
|
130
|
-
|
131
130
|
# == build_attribute
|
132
131
|
#
|
133
132
|
# This method was originally called from Nodes::Grouping#new_condition
|
@@ -255,6 +254,13 @@ module Ransack
|
|
255
254
|
end
|
256
255
|
end
|
257
256
|
|
257
|
+
def attr_value_for_attribute(attr)
|
258
|
+
return attr.attr if ActiveRecord::Base.connection.adapter_name == "PostgreSQL"
|
259
|
+
|
260
|
+
predicate.case_insensitive ? attr.attr.lower : attr.attr
|
261
|
+
rescue
|
262
|
+
attr.attr
|
263
|
+
end
|
258
264
|
|
259
265
|
def default_type
|
260
266
|
predicate.type || (attributes.first && attributes.first.type)
|
@@ -108,7 +108,7 @@ module Ransack
|
|
108
108
|
alias :g= :groupings=
|
109
109
|
|
110
110
|
def method_missing(method_id, *args)
|
111
|
-
method_name = method_id.to_s
|
111
|
+
method_name = method_id.to_s.dup
|
112
112
|
writer = method_name.sub!(/\=$/, ''.freeze)
|
113
113
|
if attribute_method?(method_name)
|
114
114
|
if writer
|
data/lib/ransack/nodes/sort.rb
CHANGED
@@ -9,7 +9,7 @@ module Ransack
|
|
9
9
|
class << self
|
10
10
|
def extract(context, str)
|
11
11
|
return unless str
|
12
|
-
attr, direction = str.split(/\s+/,2)
|
12
|
+
attr, direction = str.split(/\s+/, 2)
|
13
13
|
self.new(context).build(name: attr, dir: direction)
|
14
14
|
end
|
15
15
|
end
|
@@ -31,8 +31,8 @@ module Ransack
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def name=(name)
|
34
|
-
@name = name
|
35
|
-
context.bind(self, name)
|
34
|
+
@name = context.ransackable_alias(name) || name
|
35
|
+
context.bind(self, @name)
|
36
36
|
end
|
37
37
|
|
38
38
|
def dir=(dir)
|
data/lib/ransack/nodes/value.rb
CHANGED
data/lib/ransack/predicate.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Ransack
|
2
2
|
class Predicate
|
3
3
|
attr_reader :name, :arel_predicate, :type, :formatter, :validator,
|
4
|
-
:compound, :wants_array
|
4
|
+
:compound, :wants_array, :case_insensitive
|
5
5
|
|
6
6
|
class << self
|
7
7
|
|
@@ -42,6 +42,7 @@ module Ransack
|
|
42
42
|
@compound = opts[:compound]
|
43
43
|
@wants_array = opts.fetch(:wants_array,
|
44
44
|
@compound || Constants::IN_NOT_IN.include?(@arel_predicate))
|
45
|
+
@case_insensitive = opts[:case_insensitive]
|
45
46
|
end
|
46
47
|
|
47
48
|
def eql?(other)
|