ransack 2.3.0 → 2.4.2
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/.github/FUNDING.yml +3 -0
- data/.github/SECURITY.md +12 -0
- data/.github/workflows/cronjob.yml +105 -0
- data/.github/workflows/rubocop.yml +20 -0
- data/.github/workflows/test.yml +154 -0
- data/.rubocop.yml +44 -0
- data/CHANGELOG.md +31 -1
- data/CONTRIBUTING.md +13 -11
- data/Gemfile +19 -5
- data/README.md +119 -54
- 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 +20 -0
- data/{polyamorous/lib/polyamorous/activerecord_5.2.1_ruby_2 → lib/polyamorous/activerecord_5.2_ruby_2}/join_association.rb +4 -2
- data/{polyamorous/lib/polyamorous/activerecord_5.2.1_ruby_2 → lib/polyamorous/activerecord_5.2_ruby_2}/join_dependency.rb +0 -2
- 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/{polyamorous/lib → lib}/polyamorous/activerecord_6.0_ruby_2/join_dependency.rb +0 -1
- 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/{polyamorous/lib → lib}/polyamorous/activerecord_6.1_ruby_2/reflection.rb +0 -1
- data/lib/polyamorous/activerecord_6.2_ruby_2/join_association.rb +1 -0
- data/lib/polyamorous/activerecord_6.2_ruby_2/join_dependency.rb +1 -0
- data/lib/polyamorous/activerecord_6.2_ruby_2/reflection.rb +1 -0
- data/{polyamorous/lib → lib}/polyamorous/join.rb +0 -0
- data/{polyamorous/lib → lib/polyamorous}/polyamorous.rb +3 -8
- data/{polyamorous/lib → lib}/polyamorous/swapping_reflection_class.rb +0 -0
- data/{polyamorous/lib → lib}/polyamorous/tree_node.rb +0 -0
- data/lib/ransack.rb +3 -4
- data/lib/ransack/adapters/active_record/base.rb +4 -0
- data/lib/ransack/adapters/active_record/context.rb +51 -80
- data/lib/ransack/adapters/active_record/ransack/constants.rb +13 -1
- data/lib/ransack/adapters/active_record/ransack/context.rb +2 -6
- data/lib/ransack/adapters/active_record/ransack/nodes/condition.rb +11 -4
- data/lib/ransack/configuration.rb +17 -1
- data/lib/ransack/constants.rb +2 -5
- data/lib/ransack/helpers.rb +1 -1
- data/lib/ransack/helpers/form_builder.rb +8 -14
- data/lib/ransack/locale/sk.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 +1 -1
- data/lib/ransack/nodes/value.rb +1 -1
- data/lib/ransack/predicate.rb +2 -1
- data/lib/ransack/search.rb +3 -1
- data/lib/ransack/translate.rb +3 -3
- data/lib/ransack/version.rb +1 -1
- 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 +1 -10
- data/spec/helpers/ransack_helper.rb +1 -1
- data/spec/{ransack → polyamorous}/join_association_spec.rb +7 -0
- data/spec/{ransack → polyamorous}/join_dependency_spec.rb +0 -0
- data/spec/{ransack → polyamorous}/join_spec.rb +0 -0
- data/spec/ransack/adapters/active_record/base_spec.rb +9 -6
- data/spec/ransack/adapters/active_record/context_spec.rb +19 -18
- data/spec/ransack/configuration_spec.rb +10 -0
- data/spec/ransack/helpers/form_helper_spec.rb +16 -16
- data/spec/ransack/nodes/grouping_spec.rb +2 -2
- data/spec/ransack/predicate_spec.rb +39 -1
- data/spec/ransack/search_spec.rb +105 -17
- data/spec/spec_helper.rb +9 -5
- data/spec/support/schema.rb +8 -3
- metadata +41 -177
- data/.travis.yml +0 -49
- data/polyamorous/lib/polyamorous/activerecord_5.0_ruby_2/join_association.rb +0 -2
- data/polyamorous/lib/polyamorous/activerecord_5.0_ruby_2/join_dependency.rb +0 -2
- data/polyamorous/lib/polyamorous/activerecord_5.1_ruby_2/join_association.rb +0 -31
- data/polyamorous/lib/polyamorous/activerecord_5.1_ruby_2/join_dependency.rb +0 -112
- data/polyamorous/lib/polyamorous/activerecord_5.2.0_ruby_2/join_association.rb +0 -31
- data/polyamorous/lib/polyamorous/activerecord_5.2.0_ruby_2/join_dependency.rb +0 -112
- data/polyamorous/lib/polyamorous/activerecord_5.2.0_ruby_2/reflection.rb +0 -12
- data/polyamorous/lib/polyamorous/activerecord_5.2.1_ruby_2/reflection.rb +0 -2
- data/polyamorous/lib/polyamorous/activerecord_6.0_ruby_2/join_association.rb +0 -2
- data/polyamorous/lib/polyamorous/activerecord_6.0_ruby_2/reflection.rb +0 -2
- data/polyamorous/lib/polyamorous/activerecord_6.1_ruby_2/join_association.rb +0 -2
- data/polyamorous/lib/polyamorous/activerecord_6.1_ruby_2/join_dependency.rb +0 -2
- data/polyamorous/lib/polyamorous/version.rb +0 -3
- data/polyamorous/polyamorous.gemspec +0 -35
|
@@ -13,6 +13,18 @@ module Ransack
|
|
|
13
13
|
formatter: proc { |v| "%#{escape_wildcards(v)}%" }
|
|
14
14
|
}
|
|
15
15
|
],
|
|
16
|
+
['i_cont'.freeze, {
|
|
17
|
+
arel_predicate: 'matches'.freeze,
|
|
18
|
+
formatter: proc { |v| "%#{escape_wildcards(v.downcase)}%" },
|
|
19
|
+
case_insensitive: true
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
['not_i_cont'.freeze, {
|
|
23
|
+
arel_predicate: 'does_not_match'.freeze,
|
|
24
|
+
formatter: proc { |v| "%#{escape_wildcards(v.downcase)}%" },
|
|
25
|
+
case_insensitive: true
|
|
26
|
+
}
|
|
27
|
+
],
|
|
16
28
|
['start'.freeze, {
|
|
17
29
|
arel_predicate: 'matches'.freeze,
|
|
18
30
|
formatter: proc { |v| "#{escape_wildcards(v)}%" }
|
|
@@ -85,7 +97,7 @@ module Ransack
|
|
|
85
97
|
arel_predicate: proc { |v| v ? EQ : NOT_EQ },
|
|
86
98
|
compounds: false,
|
|
87
99
|
type: :boolean,
|
|
88
|
-
validator: proc { |v| BOOLEAN_VALUES.include?(v)},
|
|
100
|
+
validator: proc { |v| BOOLEAN_VALUES.include?(v) },
|
|
89
101
|
formatter: proc { |v| nil }
|
|
90
102
|
}
|
|
91
103
|
],
|
|
@@ -28,14 +28,10 @@ module Ransack
|
|
|
28
28
|
@join_type = options[:join_type] || Polyamorous::OuterJoin
|
|
29
29
|
@search_key = options[:search_key] || Ransack.options[:search_key]
|
|
30
30
|
@associations_pot = {}
|
|
31
|
+
@tables_pot = {}
|
|
31
32
|
@lock_associations = []
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
@base = @join_dependency.instance_variable_get(:@join_root)
|
|
35
|
-
else
|
|
36
|
-
@base = @join_dependency.join_root
|
|
37
|
-
@engine = @base.base_klass.arel_engine
|
|
38
|
-
end
|
|
34
|
+
@base = @join_dependency.instance_variable_get(:@join_root)
|
|
39
35
|
end
|
|
40
36
|
|
|
41
37
|
def bind_pair_for(key)
|
|
@@ -30,7 +30,7 @@ module Ransack
|
|
|
30
30
|
def format_predicate(attribute)
|
|
31
31
|
arel_pred = arel_predicate_for_attribute(attribute)
|
|
32
32
|
arel_values = formatted_values_for_attribute(attribute)
|
|
33
|
-
predicate = attribute.
|
|
33
|
+
predicate = attr_value_for_attribute(attribute).public_send(arel_pred, arel_values)
|
|
34
34
|
|
|
35
35
|
if in_predicate?(predicate)
|
|
36
36
|
predicate.right = predicate.right.map do |pr|
|
|
@@ -47,12 +47,19 @@ module Ransack
|
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
def casted_array?(predicate)
|
|
50
|
-
predicate.respond_to?(:
|
|
50
|
+
(predicate.respond_to?(:value) && predicate.value.is_a?(Array)) || # Rails 6.1
|
|
51
|
+
(predicate.respond_to?(:val) && predicate.val.is_a?(Array)) # Rails 5.2, 6.0
|
|
51
52
|
end
|
|
52
53
|
|
|
53
54
|
def format_values_for(predicate)
|
|
54
|
-
predicate.
|
|
55
|
-
|
|
55
|
+
value = if predicate.respond_to?(:value)
|
|
56
|
+
predicate.value # Rails 6.1
|
|
57
|
+
else
|
|
58
|
+
predicate.val # Rails 5.2, 6.0
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
value.map do |val|
|
|
62
|
+
val.is_a?(String) ? Arel::Nodes.build_quoted(val) : val
|
|
56
63
|
end
|
|
57
64
|
end
|
|
58
65
|
|
|
@@ -33,7 +33,8 @@ module Ransack
|
|
|
33
33
|
:up_arrow => '▼'.freeze,
|
|
34
34
|
:down_arrow => '▲'.freeze,
|
|
35
35
|
:default_arrow => nil,
|
|
36
|
-
:sanitize_scope_args => true
|
|
36
|
+
:sanitize_scope_args => true,
|
|
37
|
+
:postgres_fields_sort_option => nil
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
def configure
|
|
@@ -141,6 +142,21 @@ module Ransack
|
|
|
141
142
|
self.options[:sanitize_scope_args] = boolean
|
|
142
143
|
end
|
|
143
144
|
|
|
145
|
+
# The `NULLS FIRST` and `NULLS LAST` options can be used to determine
|
|
146
|
+
# whether nulls appear before or after non-null values in the sort ordering.
|
|
147
|
+
#
|
|
148
|
+
# User may want to configure it like this:
|
|
149
|
+
#
|
|
150
|
+
# Ransack.configure do |c|
|
|
151
|
+
# c.postgres_fields_sort_option = :nulls_first # or :nulls_last
|
|
152
|
+
# end
|
|
153
|
+
#
|
|
154
|
+
# See this feature: https://www.postgresql.org/docs/13/queries-order.html
|
|
155
|
+
#
|
|
156
|
+
def postgres_fields_sort_option=(setting)
|
|
157
|
+
self.options[:postgres_fields_sort_option] = setting
|
|
158
|
+
end
|
|
159
|
+
|
|
144
160
|
# By default, Ransack displays sort order indicator arrows in sort links.
|
|
145
161
|
# The default may be globally overridden in an initializer file like
|
|
146
162
|
# `config/initializers/ransack.rb` as follows:
|
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,13 +45,10 @@ module Ransack
|
|
|
45
45
|
NOT_EQ_ALL = 'not_eq_all'.freeze
|
|
46
46
|
CONT = 'cont'.freeze
|
|
47
47
|
|
|
48
|
-
RAILS_5_1 = '5.1'.freeze
|
|
49
|
-
RAILS_5_2 = '5.2'.freeze
|
|
50
|
-
RAILS_5_2_0 = '5.2.0'.freeze
|
|
51
48
|
RAILS_6_0 = '6.0.0'.freeze
|
|
49
|
+
RAILS_6_1 = '6.1.0'.freeze
|
|
52
50
|
|
|
53
51
|
RANSACK_SLASH_SEARCHES = 'ransack/searches'.freeze
|
|
54
52
|
RANSACK_SLASH_SEARCHES_SLASH_SEARCH = 'ransack/searches/search'.freeze
|
|
55
53
|
end
|
|
56
54
|
end
|
|
57
|
-
|
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'
|
|
@@ -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)
|
|
@@ -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"
|
|
@@ -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
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)
|
data/lib/ransack/search.rb
CHANGED
|
@@ -18,6 +18,7 @@ module Ransack
|
|
|
18
18
|
params = params.to_unsafe_h if params.respond_to?(:to_unsafe_h)
|
|
19
19
|
if params.is_a? Hash
|
|
20
20
|
params = params.dup
|
|
21
|
+
params = params.transform_values { |v| v.is_a?(String) ? v.strip : v }
|
|
21
22
|
params.delete_if { |k, v| [*v].all?{ |i| i.blank? && i != false } }
|
|
22
23
|
else
|
|
23
24
|
params = {}
|
|
@@ -29,6 +30,7 @@ module Ransack
|
|
|
29
30
|
)
|
|
30
31
|
@scope_args = {}
|
|
31
32
|
@sorts ||= []
|
|
33
|
+
@ignore_unknown_conditions = options[:ignore_unknown_conditions] == false ? false : true
|
|
32
34
|
build(params.with_indifferent_access)
|
|
33
35
|
end
|
|
34
36
|
|
|
@@ -44,7 +46,7 @@ module Ransack
|
|
|
44
46
|
base.send("#{key}=", value)
|
|
45
47
|
elsif @context.ransackable_scope?(key, @context.object)
|
|
46
48
|
add_scope(key, value)
|
|
47
|
-
elsif !Ransack.options[:ignore_unknown_conditions]
|
|
49
|
+
elsif !Ransack.options[:ignore_unknown_conditions] || !@ignore_unknown_conditions
|
|
48
50
|
raise ArgumentError, "Invalid search term #{key}"
|
|
49
51
|
end
|
|
50
52
|
end
|
data/lib/ransack/translate.rb
CHANGED
|
@@ -50,7 +50,7 @@ module Ransack
|
|
|
50
50
|
|
|
51
51
|
defaults << options.delete(:default) if options[:default]
|
|
52
52
|
options.reverse_merge! count: 1, default: defaults
|
|
53
|
-
I18n.translate(defaults.shift, options.merge(interpolations))
|
|
53
|
+
I18n.translate(defaults.shift, **options.merge(interpolations))
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
def association(key, options = {})
|
|
@@ -67,7 +67,7 @@ module Ransack
|
|
|
67
67
|
end
|
|
68
68
|
defaults << context.traverse(key).model_name.human
|
|
69
69
|
options = { :count => 1, :default => defaults }
|
|
70
|
-
I18n.translate(defaults.shift, options)
|
|
70
|
+
I18n.translate(defaults.shift, **options)
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
private
|
|
@@ -83,7 +83,7 @@ module Ransack
|
|
|
83
83
|
options = { count: 1, default: defaults }
|
|
84
84
|
interpolations = build_interpolations(associated_class)
|
|
85
85
|
|
|
86
|
-
I18n.translate(defaults.shift, options.merge(interpolations))
|
|
86
|
+
I18n.translate(defaults.shift, **options.merge(interpolations))
|
|
87
87
|
end
|
|
88
88
|
|
|
89
89
|
def default_attribute_name
|
data/lib/ransack/version.rb
CHANGED
data/ransack.gemspec
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
+
|
|
2
3
|
$:.push File.expand_path("../lib", __FILE__)
|
|
3
4
|
require "ransack/version"
|
|
4
5
|
|
|
@@ -6,36 +7,20 @@ Gem::Specification.new do |s|
|
|
|
6
7
|
s.name = "ransack"
|
|
7
8
|
s.version = Ransack::VERSION
|
|
8
9
|
s.platform = Gem::Platform::RUBY
|
|
9
|
-
s.authors = ["Ernie Miller", "Ryan Bigg", "Jon Atack","Sean Carroll"]
|
|
10
|
-
s.email = ["ernie@erniemiller.org", "radarlistener@gmail.com", "jonnyatack@gmail.com","sfcarroll@gmail.com"]
|
|
10
|
+
s.authors = ["Ernie Miller", "Ryan Bigg", "Jon Atack", "Sean Carroll"]
|
|
11
|
+
s.email = ["ernie@erniemiller.org", "radarlistener@gmail.com", "jonnyatack@gmail.com", "sfcarroll@gmail.com"]
|
|
11
12
|
s.homepage = "https://github.com/activerecord-hackery/ransack"
|
|
12
13
|
s.summary = %q{Object-based searching for Active Record and Mongoid (currently).}
|
|
13
14
|
s.description = %q{Ransack is the successor to the MetaSearch gem. It improves and expands upon MetaSearch's functionality, but does not have a 100%-compatible API.}
|
|
14
|
-
s.required_ruby_version = '>=
|
|
15
|
+
s.required_ruby_version = '>= 2.6'
|
|
15
16
|
s.license = 'MIT'
|
|
16
17
|
|
|
17
|
-
s.add_dependency '
|
|
18
|
-
s.add_dependency '
|
|
19
|
-
s.add_dependency 'activesupport', '>= 5.0'
|
|
18
|
+
s.add_dependency 'activerecord', '>= 5.2.4'
|
|
19
|
+
s.add_dependency 'activesupport', '>= 5.2.4'
|
|
20
20
|
s.add_dependency 'i18n'
|
|
21
|
-
s.add_dependency 'polyamorous', Ransack::VERSION.to_s
|
|
22
|
-
s.add_development_dependency 'rspec', '~> 3'
|
|
23
|
-
s.add_development_dependency 'machinist', '~> 1.0.6'
|
|
24
|
-
s.add_development_dependency 'faker', '~> 0.9.5'
|
|
25
|
-
s.add_development_dependency 'sqlite3', ::Gem::Version.new(ENV['RAILS'].gsub(/^v/, '')) >= ::Gem::Version.new('6-0-stable') ? '~> 1.4.1' : '~> 1.3.3'
|
|
26
|
-
s.add_development_dependency 'pg', '~> 0.21'
|
|
27
|
-
s.add_development_dependency 'mysql2', '0.3.20'
|
|
28
|
-
s.add_development_dependency 'pry', '0.10'
|
|
29
|
-
s.add_development_dependency 'byebug'
|
|
30
21
|
|
|
31
22
|
s.files = `git ls-files`.split("\n")
|
|
32
|
-
|
|
33
|
-
s.
|
|
34
|
-
.split("\n")
|
|
35
|
-
|
|
36
|
-
s.executables = `git ls-files -- bin/*`
|
|
37
|
-
.split("\n")
|
|
38
|
-
.map { |f| File.basename(f) }
|
|
39
|
-
|
|
23
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
24
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
40
25
|
s.require_paths = ["lib"]
|
|
41
26
|
end
|
data/spec/blueprints/articles.rb
CHANGED
data/spec/blueprints/comments.rb
CHANGED
data/spec/blueprints/notes.rb
CHANGED