ransack 2.5.0 → 3.0.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 +4 -4
- data/.github/workflows/deploy.yml +35 -0
- data/.github/workflows/test-deploy.yml +29 -0
- data/.github/workflows/test.yml +0 -18
- data/.nojekyll +0 -0
- data/CHANGELOG.md +101 -13
- data/CONTRIBUTING.md +1 -3
- data/README.md +45 -1039
- 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/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/{img → 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/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 +107 -0
- data/docs/package.json +37 -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/{logo → docs/static/logo}/ransack-h.png +0 -0
- data/{logo → docs/static/logo}/ransack-h.svg +0 -0
- data/{logo → docs/static/logo}/ransack-v.png +0 -0
- data/{logo → docs/static/logo}/ransack-v.svg +0 -0
- data/{logo → docs/static/logo}/ransack.png +0 -0
- data/{logo → docs/static/logo}/ransack.svg +0 -0
- data/docs/yarn.lock +7671 -0
- data/lib/polyamorous/activerecord_6.0_ruby_2/join_association.rb +20 -1
- data/lib/polyamorous/activerecord_6.0_ruby_2/join_dependency.rb +0 -1
- data/lib/polyamorous/activerecord_6.0_ruby_2/reflection.rb +11 -1
- data/lib/polyamorous/activerecord_6.1_ruby_2/join_association.rb +0 -4
- data/lib/polyamorous/activerecord_6.1_ruby_2/join_dependency.rb +0 -1
- data/lib/ransack/adapters/active_record/base.rb +0 -2
- data/lib/ransack/adapters/active_record/context.rb +1 -0
- data/lib/ransack/adapters/active_record/ransack/nodes/condition.rb +1 -1
- data/lib/ransack/helpers/form_helper.rb +11 -3
- data/lib/ransack/search.rb +2 -2
- data/lib/ransack/version.rb +1 -1
- data/ransack.gemspec +4 -4
- data/spec/polyamorous/activerecord_compatibility_spec.rb +15 -0
- data/spec/polyamorous/join_association_spec.rb +0 -5
- data/spec/polyamorous/join_dependency_spec.rb +0 -16
- data/spec/ransack/adapters/active_record/base_spec.rb +10 -1
- data/spec/ransack/helpers/form_helper_spec.rb +45 -2
- data/spec/ransack/search_spec.rb +23 -0
- data/spec/support/schema.rb +26 -0
- metadata +66 -19
- data/docs/release_process.md +0 -17
- data/lib/polyamorous/activerecord_5.2_ruby_2/join_association.rb +0 -24
- data/lib/polyamorous/activerecord_5.2_ruby_2/join_dependency.rb +0 -79
- data/lib/polyamorous/activerecord_5.2_ruby_2/reflection.rb +0 -11
|
@@ -1 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
module Polyamorous
|
|
2
|
+
module JoinAssociationExtensions
|
|
3
|
+
include SwappingReflectionClass
|
|
4
|
+
def self.prepended(base)
|
|
5
|
+
base.class_eval { attr_reader :join_type }
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def initialize(reflection, children, polymorphic_class = nil, join_type = Arel::Nodes::InnerJoin)
|
|
9
|
+
@join_type = join_type
|
|
10
|
+
if polymorphic_class && ::ActiveRecord::Base > polymorphic_class
|
|
11
|
+
swapping_reflection_klass(reflection, polymorphic_class) do |reflection|
|
|
12
|
+
super(reflection, children)
|
|
13
|
+
self.reflection.options[:polymorphic] = true
|
|
14
|
+
end
|
|
15
|
+
else
|
|
16
|
+
super(reflection, children)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
module Polyamorous
|
|
2
|
+
module ReflectionExtensions
|
|
3
|
+
def join_scope(table, foreign_table, foreign_klass)
|
|
4
|
+
if respond_to?(:polymorphic?) && polymorphic?
|
|
5
|
+
super.where!(foreign_table[foreign_type].eq(klass.name))
|
|
6
|
+
else
|
|
7
|
+
super
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -4,7 +4,6 @@ module Ransack
|
|
|
4
4
|
module Base
|
|
5
5
|
|
|
6
6
|
def self.extended(base)
|
|
7
|
-
alias :search :ransack unless base.respond_to? :search
|
|
8
7
|
base.class_eval do
|
|
9
8
|
class_attribute :_ransackers
|
|
10
9
|
class_attribute :_ransack_aliases
|
|
@@ -14,7 +13,6 @@ module Ransack
|
|
|
14
13
|
end
|
|
15
14
|
|
|
16
15
|
def ransack(params = {}, options = {})
|
|
17
|
-
ActiveSupport::Deprecation.warn("#search is deprecated and will be removed in 2.3, please use #ransack instead") if __callee__ == :search
|
|
18
16
|
Search.new(self, params, options)
|
|
19
17
|
end
|
|
20
18
|
|
|
@@ -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).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/search.rb
CHANGED
|
@@ -43,10 +43,10 @@ module Ransack
|
|
|
43
43
|
collapse_multiparameter_attributes!(params).each do |key, value|
|
|
44
44
|
if ['s'.freeze, 'sorts'.freeze].freeze.include?(key)
|
|
45
45
|
send("#{key}=", value)
|
|
46
|
-
elsif base.attribute_method?(key)
|
|
47
|
-
base.send("#{key}=", value)
|
|
48
46
|
elsif @context.ransackable_scope?(key, @context.object)
|
|
49
47
|
add_scope(key, value)
|
|
48
|
+
elsif base.attribute_method?(key)
|
|
49
|
+
base.send("#{key}=", value)
|
|
50
50
|
elsif !Ransack.options[:ignore_unknown_conditions] || !@ignore_unknown_conditions
|
|
51
51
|
raise ArgumentError, "Invalid search term #{key}"
|
|
52
52
|
end
|
data/lib/ransack/version.rb
CHANGED
data/ransack.gemspec
CHANGED
|
@@ -7,16 +7,16 @@ Gem::Specification.new do |s|
|
|
|
7
7
|
s.name = "ransack"
|
|
8
8
|
s.version = Ransack::VERSION
|
|
9
9
|
s.platform = Gem::Platform::RUBY
|
|
10
|
-
s.authors = ["Ernie Miller", "Ryan Bigg", "Jon Atack", "Sean Carroll"]
|
|
10
|
+
s.authors = ["Ernie Miller", "Ryan Bigg", "Jon Atack", "Sean Carroll", "David Rodríguez"]
|
|
11
11
|
s.email = ["ernie@erniemiller.org", "radarlistener@gmail.com", "jonnyatack@gmail.com", "sfcarroll@gmail.com"]
|
|
12
12
|
s.homepage = "https://github.com/activerecord-hackery/ransack"
|
|
13
|
-
s.summary = %q{Object-based searching for Active Record
|
|
13
|
+
s.summary = %q{Object-based searching for Active Record.}
|
|
14
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.}
|
|
15
15
|
s.required_ruby_version = '>= 2.6'
|
|
16
16
|
s.license = 'MIT'
|
|
17
17
|
|
|
18
|
-
s.add_dependency 'activerecord', '>=
|
|
19
|
-
s.add_dependency 'activesupport', '>=
|
|
18
|
+
s.add_dependency 'activerecord', '>= 6.0.4'
|
|
19
|
+
s.add_dependency 'activesupport', '>= 6.0.4'
|
|
20
20
|
s.add_dependency 'i18n'
|
|
21
21
|
|
|
22
22
|
s.files = `git ls-files`.split("\n")
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
module Polyamorous
|
|
4
|
+
describe "ActiveRecord Compatibility" do
|
|
5
|
+
it 'works with self joins and includes' do
|
|
6
|
+
trade_account = Account.create!
|
|
7
|
+
Account.create!(trade_account: trade_account)
|
|
8
|
+
|
|
9
|
+
accounts = Account.joins(:trade_account).includes(:trade_account, :agent_account)
|
|
10
|
+
account = accounts.first
|
|
11
|
+
|
|
12
|
+
expect(account.agent_account).to be_nil
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -12,11 +12,6 @@ module Polyamorous
|
|
|
12
12
|
|
|
13
13
|
subject { new_join_association(reflection, parent.children, Person) }
|
|
14
14
|
|
|
15
|
-
it 'respects polymorphism on equality test' do
|
|
16
|
-
expect(subject).to eq new_join_association(reflection, parent.children, Person)
|
|
17
|
-
expect(subject).not_to eq new_join_association(reflection, parent.children, Article)
|
|
18
|
-
end
|
|
19
|
-
|
|
20
15
|
it 'leaves the original reflection intact for thread safety' do
|
|
21
16
|
reflection.instance_variable_set(:@klass, Article)
|
|
22
17
|
join_association
|
|
@@ -77,21 +77,5 @@ module Polyamorous
|
|
|
77
77
|
specify { expect(subject.send(:join_root).drop(1)[1].table_name)
|
|
78
78
|
.to eq 'comments' }
|
|
79
79
|
end
|
|
80
|
-
|
|
81
|
-
context '#left_outer_join in Rails 5 overrides join type specified',
|
|
82
|
-
if: ActiveRecord::VERSION::MAJOR >= 5 && ActiveRecord::VERSION::MAJOR < 6 && ActiveRecord::VERSION::MINOR < 2 do
|
|
83
|
-
|
|
84
|
-
let(:join_type_class) do
|
|
85
|
-
new_join_dependency(
|
|
86
|
-
Person,
|
|
87
|
-
new_join(:articles)
|
|
88
|
-
).join_constraints(
|
|
89
|
-
[],
|
|
90
|
-
Arel::Nodes::OuterJoin
|
|
91
|
-
).first.joins.map(&:class)
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
specify { expect(join_type_class).to eq [Arel::Nodes::OuterJoin] }
|
|
95
|
-
end
|
|
96
80
|
end
|
|
97
81
|
end
|
|
@@ -8,7 +8,6 @@ module Ransack
|
|
|
8
8
|
subject { ::ActiveRecord::Base }
|
|
9
9
|
|
|
10
10
|
it { should respond_to :ransack }
|
|
11
|
-
it { should respond_to :search }
|
|
12
11
|
|
|
13
12
|
describe '#search' do
|
|
14
13
|
subject { Person.ransack }
|
|
@@ -78,6 +77,16 @@ module Ransack
|
|
|
78
77
|
expect(s.result.to_sql).to (include 'active = 1')
|
|
79
78
|
end
|
|
80
79
|
|
|
80
|
+
it 'applies scopes that define string SQL joins' do
|
|
81
|
+
allow(Article)
|
|
82
|
+
.to receive(:ransackable_scopes)
|
|
83
|
+
.and_return([:latest_comment_cont])
|
|
84
|
+
|
|
85
|
+
# Including a negative condition to test removing the scope
|
|
86
|
+
s = Search.new(Article, notes_note_not_eq: 'Test', latest_comment_cont: 'Test')
|
|
87
|
+
expect(s.result.to_sql).to include 'latest_comment'
|
|
88
|
+
end
|
|
89
|
+
|
|
81
90
|
context "with sanitize_custom_scope_booleans set to false" do
|
|
82
91
|
before(:all) do
|
|
83
92
|
Ransack.configure { |c| c.sanitize_custom_scope_booleans = false }
|
|
@@ -469,8 +469,7 @@ module Ransack
|
|
|
469
469
|
it { should match /exist\=existing/ }
|
|
470
470
|
end
|
|
471
471
|
|
|
472
|
-
context 'using a real ActionController::Parameter object'
|
|
473
|
-
if: ::ActiveRecord::VERSION::MAJOR > 3 do
|
|
472
|
+
context 'using a real ActionController::Parameter object' do
|
|
474
473
|
|
|
475
474
|
describe 'with symbol q:, #sort_link should include search params' do
|
|
476
475
|
subject { @controller.view_context.sort_link(Person.ransack, :name) }
|
|
@@ -727,6 +726,50 @@ module Ransack
|
|
|
727
726
|
it { should match /Block label ▼/ }
|
|
728
727
|
end
|
|
729
728
|
|
|
729
|
+
describe '#sort_link with class option' do
|
|
730
|
+
subject { @controller.view_context
|
|
731
|
+
.sort_link(
|
|
732
|
+
[:main_app, Person.ransack(sorts: ['name desc'])],
|
|
733
|
+
:name,
|
|
734
|
+
class: 'people', controller: 'people'
|
|
735
|
+
)
|
|
736
|
+
}
|
|
737
|
+
it { should match /class="sort_link desc people"/ }
|
|
738
|
+
it { should_not match /people\?class=people/ }
|
|
739
|
+
end
|
|
740
|
+
|
|
741
|
+
describe '#sort_link with class option workaround' do
|
|
742
|
+
it "generates a correct link and prints a deprecation" do
|
|
743
|
+
expect do
|
|
744
|
+
link = @controller.view_context
|
|
745
|
+
.sort_link(
|
|
746
|
+
[:main_app, Person.ransack(sorts: ['name desc'])],
|
|
747
|
+
:name,
|
|
748
|
+
'name',
|
|
749
|
+
{ controller: 'people' },
|
|
750
|
+
class: 'people'
|
|
751
|
+
)
|
|
752
|
+
|
|
753
|
+
expect(link).to match(/class="sort_link desc people"/)
|
|
754
|
+
expect(link).not_to match(/people\?class=people/)
|
|
755
|
+
end.to output(
|
|
756
|
+
/Passing two trailing hashes to `sort_link` is deprecated, merge the trailing hashes into a single one\. \(called at #{Regexp.escape(__FILE__)}:/
|
|
757
|
+
).to_stderr
|
|
758
|
+
end
|
|
759
|
+
end
|
|
760
|
+
|
|
761
|
+
describe '#sort_link with data option' do
|
|
762
|
+
subject { @controller.view_context
|
|
763
|
+
.sort_link(
|
|
764
|
+
[:main_app, Person.ransack(sorts: ['name desc'])],
|
|
765
|
+
:name,
|
|
766
|
+
data: { turbo_action: :advance }, controller: 'people'
|
|
767
|
+
)
|
|
768
|
+
}
|
|
769
|
+
it { should match /data-turbo-action="advance"/ }
|
|
770
|
+
it { should_not match /people\?data%5Bturbo_action%5D=advance/ }
|
|
771
|
+
end
|
|
772
|
+
|
|
730
773
|
describe '#search_form_for with default format' do
|
|
731
774
|
subject { @controller.view_context
|
|
732
775
|
.search_form_for(Person.ransack) {} }
|
data/spec/ransack/search_spec.rb
CHANGED
|
@@ -312,6 +312,29 @@ module Ransack
|
|
|
312
312
|
expect { Search.new(Person, params) }.not_to change { params }
|
|
313
313
|
end
|
|
314
314
|
|
|
315
|
+
context "ransackable_scope" do
|
|
316
|
+
around(:each) do |example|
|
|
317
|
+
Person.define_singleton_method(:name_eq) do |name|
|
|
318
|
+
self.where(name: name)
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
begin
|
|
322
|
+
example.run
|
|
323
|
+
ensure
|
|
324
|
+
Person.singleton_class.undef_method :name_eq
|
|
325
|
+
end
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
it "is prioritized over base predicates" do
|
|
329
|
+
allow(Person).to receive(:ransackable_scopes)
|
|
330
|
+
.and_return(Person.ransackable_scopes + [:name_eq])
|
|
331
|
+
|
|
332
|
+
s = Search.new(Person, name_eq: "Johny")
|
|
333
|
+
expect(s.instance_variable_get(:@scope_args)["name_eq"]).to eq("Johny")
|
|
334
|
+
expect(s.base[:name_eq]).to be_nil
|
|
335
|
+
end
|
|
336
|
+
end
|
|
337
|
+
|
|
315
338
|
end
|
|
316
339
|
|
|
317
340
|
describe '#result' do
|
data/spec/support/schema.rb
CHANGED
|
@@ -138,6 +138,22 @@ class Article < ActiveRecord::Base
|
|
|
138
138
|
alias_attribute :content, :body
|
|
139
139
|
|
|
140
140
|
default_scope { where("'default_scope' = 'default_scope'") }
|
|
141
|
+
scope :latest_comment_cont, lambda { |msg|
|
|
142
|
+
join = <<-SQL
|
|
143
|
+
(LEFT OUTER JOIN (
|
|
144
|
+
SELECT
|
|
145
|
+
comments.*,
|
|
146
|
+
row_number() OVER (PARTITION BY comments.article_id ORDER BY comments.id DESC) AS rownum
|
|
147
|
+
FROM comments
|
|
148
|
+
) AS latest_comment
|
|
149
|
+
ON latest_comment.article_id = article.id
|
|
150
|
+
AND latest_comment.rownum = 1
|
|
151
|
+
)
|
|
152
|
+
SQL
|
|
153
|
+
.squish
|
|
154
|
+
|
|
155
|
+
joins(join).where("latest_comment.body ILIKE ?", "%#{msg}%")
|
|
156
|
+
}
|
|
141
157
|
|
|
142
158
|
ransacker :title_type, formatter: lambda { |tuples|
|
|
143
159
|
title, type = JSON.parse(tuples)
|
|
@@ -199,6 +215,11 @@ class Note < ActiveRecord::Base
|
|
|
199
215
|
belongs_to :notable, polymorphic: true
|
|
200
216
|
end
|
|
201
217
|
|
|
218
|
+
class Account < ActiveRecord::Base
|
|
219
|
+
belongs_to :agent_account, class_name: "Account"
|
|
220
|
+
belongs_to :trade_account, class_name: "Account"
|
|
221
|
+
end
|
|
222
|
+
|
|
202
223
|
module Schema
|
|
203
224
|
def self.create
|
|
204
225
|
ActiveRecord::Migration.verbose = false
|
|
@@ -257,6 +278,11 @@ module Schema
|
|
|
257
278
|
t.integer :target_person_id
|
|
258
279
|
t.integer :article_id
|
|
259
280
|
end
|
|
281
|
+
|
|
282
|
+
create_table :accounts, force: true do |t|
|
|
283
|
+
t.belongs_to :agent_account
|
|
284
|
+
t.belongs_to :trade_account
|
|
285
|
+
end
|
|
260
286
|
end
|
|
261
287
|
|
|
262
288
|
10.times do
|
metadata
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ransack
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 3.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ernie Miller
|
|
8
8
|
- Ryan Bigg
|
|
9
9
|
- Jon Atack
|
|
10
10
|
- Sean Carroll
|
|
11
|
+
- David Rodríguez
|
|
11
12
|
autorequire:
|
|
12
13
|
bindir: bin
|
|
13
14
|
cert_chain: []
|
|
14
|
-
date:
|
|
15
|
+
date: 2022-04-07 00:00:00.000000000 Z
|
|
15
16
|
dependencies:
|
|
16
17
|
- !ruby/object:Gem::Dependency
|
|
17
18
|
name: activerecord
|
|
@@ -19,28 +20,28 @@ dependencies:
|
|
|
19
20
|
requirements:
|
|
20
21
|
- - ">="
|
|
21
22
|
- !ruby/object:Gem::Version
|
|
22
|
-
version:
|
|
23
|
+
version: 6.0.4
|
|
23
24
|
type: :runtime
|
|
24
25
|
prerelease: false
|
|
25
26
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
27
|
requirements:
|
|
27
28
|
- - ">="
|
|
28
29
|
- !ruby/object:Gem::Version
|
|
29
|
-
version:
|
|
30
|
+
version: 6.0.4
|
|
30
31
|
- !ruby/object:Gem::Dependency
|
|
31
32
|
name: activesupport
|
|
32
33
|
requirement: !ruby/object:Gem::Requirement
|
|
33
34
|
requirements:
|
|
34
35
|
- - ">="
|
|
35
36
|
- !ruby/object:Gem::Version
|
|
36
|
-
version:
|
|
37
|
+
version: 6.0.4
|
|
37
38
|
type: :runtime
|
|
38
39
|
prerelease: false
|
|
39
40
|
version_requirements: !ruby/object:Gem::Requirement
|
|
40
41
|
requirements:
|
|
41
42
|
- - ">="
|
|
42
43
|
- !ruby/object:Gem::Version
|
|
43
|
-
version:
|
|
44
|
+
version: 6.0.4
|
|
44
45
|
- !ruby/object:Gem::Dependency
|
|
45
46
|
name: i18n
|
|
46
47
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -69,9 +70,12 @@ files:
|
|
|
69
70
|
- ".github/FUNDING.yml"
|
|
70
71
|
- ".github/SECURITY.md"
|
|
71
72
|
- ".github/workflows/cronjob.yml"
|
|
73
|
+
- ".github/workflows/deploy.yml"
|
|
72
74
|
- ".github/workflows/rubocop.yml"
|
|
75
|
+
- ".github/workflows/test-deploy.yml"
|
|
73
76
|
- ".github/workflows/test.yml"
|
|
74
77
|
- ".gitignore"
|
|
78
|
+
- ".nojekyll"
|
|
75
79
|
- ".rubocop.yml"
|
|
76
80
|
- CHANGELOG.md
|
|
77
81
|
- CONTRIBUTING.md
|
|
@@ -81,12 +85,59 @@ files:
|
|
|
81
85
|
- Rakefile
|
|
82
86
|
- bug_report_templates/test-ransack-scope-and-column-same-name.rb
|
|
83
87
|
- bug_report_templates/test-ransacker-arel-present-predicate.rb
|
|
84
|
-
- docs
|
|
85
|
-
- docs
|
|
88
|
+
- docs/.gitignore
|
|
89
|
+
- docs/.nojekyll
|
|
90
|
+
- docs/babel.config.js
|
|
91
|
+
- docs/blog/2022-03-27-ransack-3.0.0.md
|
|
92
|
+
- docs/docs/getting-started/_category_.json
|
|
93
|
+
- docs/docs/getting-started/advanced-mode.md
|
|
94
|
+
- docs/docs/getting-started/configuration.md
|
|
95
|
+
- docs/docs/getting-started/search-matches.md
|
|
96
|
+
- docs/docs/getting-started/simple-mode.md
|
|
97
|
+
- docs/docs/getting-started/sorting.md
|
|
98
|
+
- docs/docs/getting-started/using-predicates.md
|
|
99
|
+
- docs/docs/going-further/_category_.json
|
|
100
|
+
- docs/docs/going-further/associations.md
|
|
101
|
+
- docs/docs/going-further/custom-predicates.md
|
|
102
|
+
- docs/docs/going-further/documentation.md
|
|
103
|
+
- docs/docs/going-further/exporting-to-csv.md
|
|
104
|
+
- docs/docs/going-further/external-guides.md
|
|
105
|
+
- docs/docs/going-further/form-customisation.md
|
|
106
|
+
- docs/docs/going-further/i18n.md
|
|
107
|
+
- docs/docs/going-further/img/create_release.png
|
|
108
|
+
- docs/docs/going-further/merging-searches.md
|
|
109
|
+
- docs/docs/going-further/other-notes.md
|
|
110
|
+
- docs/docs/going-further/ransackers.md
|
|
111
|
+
- docs/docs/going-further/release_process.md
|
|
112
|
+
- docs/docs/going-further/saving-queries.md
|
|
113
|
+
- docs/docs/going-further/searching-postgres.md
|
|
114
|
+
- docs/docs/going-further/wiki-contributors.md
|
|
115
|
+
- docs/docs/intro.md
|
|
116
|
+
- docs/docusaurus.config.js
|
|
117
|
+
- docs/package.json
|
|
118
|
+
- docs/sidebars.js
|
|
119
|
+
- docs/src/components/HomepageFeatures/index.js
|
|
120
|
+
- docs/src/components/HomepageFeatures/styles.module.css
|
|
121
|
+
- docs/src/css/custom.css
|
|
122
|
+
- docs/src/pages/index.module.css
|
|
123
|
+
- docs/src/pages/markdown-page.md
|
|
124
|
+
- docs/static/.nojekyll
|
|
125
|
+
- docs/static/img/docusaurus.png
|
|
126
|
+
- docs/static/img/favicon.ico
|
|
127
|
+
- docs/static/img/logo.svg
|
|
128
|
+
- docs/static/img/tutorial/docsVersionDropdown.png
|
|
129
|
+
- docs/static/img/tutorial/localeDropdown.png
|
|
130
|
+
- docs/static/img/undraw_docusaurus_mountain.svg
|
|
131
|
+
- docs/static/img/undraw_docusaurus_react.svg
|
|
132
|
+
- docs/static/img/undraw_docusaurus_tree.svg
|
|
133
|
+
- docs/static/logo/ransack-h.png
|
|
134
|
+
- docs/static/logo/ransack-h.svg
|
|
135
|
+
- docs/static/logo/ransack-v.png
|
|
136
|
+
- docs/static/logo/ransack-v.svg
|
|
137
|
+
- docs/static/logo/ransack.png
|
|
138
|
+
- docs/static/logo/ransack.svg
|
|
139
|
+
- docs/yarn.lock
|
|
86
140
|
- lib/polyamorous.rb
|
|
87
|
-
- lib/polyamorous/activerecord_5.2_ruby_2/join_association.rb
|
|
88
|
-
- lib/polyamorous/activerecord_5.2_ruby_2/join_dependency.rb
|
|
89
|
-
- lib/polyamorous/activerecord_5.2_ruby_2/reflection.rb
|
|
90
141
|
- lib/polyamorous/activerecord_6.0_ruby_2/join_association.rb
|
|
91
142
|
- lib/polyamorous/activerecord_6.0_ruby_2/join_dependency.rb
|
|
92
143
|
- lib/polyamorous/activerecord_6.0_ruby_2/reflection.rb
|
|
@@ -157,12 +208,6 @@ files:
|
|
|
157
208
|
- lib/ransack/translate.rb
|
|
158
209
|
- lib/ransack/version.rb
|
|
159
210
|
- lib/ransack/visitor.rb
|
|
160
|
-
- logo/ransack-h.png
|
|
161
|
-
- logo/ransack-h.svg
|
|
162
|
-
- logo/ransack-v.png
|
|
163
|
-
- logo/ransack-v.svg
|
|
164
|
-
- logo/ransack.png
|
|
165
|
-
- logo/ransack.svg
|
|
166
211
|
- ransack.gemspec
|
|
167
212
|
- spec/blueprints/articles.rb
|
|
168
213
|
- spec/blueprints/comments.rb
|
|
@@ -172,6 +217,7 @@ files:
|
|
|
172
217
|
- spec/console.rb
|
|
173
218
|
- spec/helpers/polyamorous_helper.rb
|
|
174
219
|
- spec/helpers/ransack_helper.rb
|
|
220
|
+
- spec/polyamorous/activerecord_compatibility_spec.rb
|
|
175
221
|
- spec/polyamorous/join_association_spec.rb
|
|
176
222
|
- spec/polyamorous/join_dependency_spec.rb
|
|
177
223
|
- spec/polyamorous/join_spec.rb
|
|
@@ -207,10 +253,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
207
253
|
- !ruby/object:Gem::Version
|
|
208
254
|
version: '0'
|
|
209
255
|
requirements: []
|
|
210
|
-
rubygems_version: 3.
|
|
256
|
+
rubygems_version: 3.3.11
|
|
211
257
|
signing_key:
|
|
212
258
|
specification_version: 4
|
|
213
|
-
summary: Object-based searching for Active Record
|
|
259
|
+
summary: Object-based searching for Active Record.
|
|
214
260
|
test_files:
|
|
215
261
|
- spec/blueprints/articles.rb
|
|
216
262
|
- spec/blueprints/comments.rb
|
|
@@ -220,6 +266,7 @@ test_files:
|
|
|
220
266
|
- spec/console.rb
|
|
221
267
|
- spec/helpers/polyamorous_helper.rb
|
|
222
268
|
- spec/helpers/ransack_helper.rb
|
|
269
|
+
- spec/polyamorous/activerecord_compatibility_spec.rb
|
|
223
270
|
- spec/polyamorous/join_association_spec.rb
|
|
224
271
|
- spec/polyamorous/join_dependency_spec.rb
|
|
225
272
|
- spec/polyamorous/join_spec.rb
|
data/docs/release_process.md
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
## Release Process
|
|
2
|
-
|
|
3
|
-
*For maintainers of Ransack.*
|
|
4
|
-
|
|
5
|
-
To release a new version of Ransack and publish it to RubyGems, take the following steps:
|
|
6
|
-
|
|
7
|
-
- Create a new release, marked `Prerelease`.
|
|
8
|
-
- Update the versions file to the new release, commit and push to `master`.
|
|
9
|
-
- Update the [`version.rb`](../lib/ransack/version.rb) file to the new release, commit and push to `master`.
|
|
10
|
-
- From the terminal, run the following commands:
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
rake build
|
|
14
|
-
rake release
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-

|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
module Polyamorous
|
|
2
|
-
module JoinAssociationExtensions
|
|
3
|
-
include SwappingReflectionClass
|
|
4
|
-
def self.prepended(base)
|
|
5
|
-
base.class_eval { attr_reader :join_type }
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def initialize(reflection, children, polymorphic_class = nil, join_type = Arel::Nodes::InnerJoin)
|
|
9
|
-
@join_type = join_type
|
|
10
|
-
if polymorphic_class && ::ActiveRecord::Base > polymorphic_class
|
|
11
|
-
swapping_reflection_klass(reflection, polymorphic_class) do |reflection|
|
|
12
|
-
super(reflection, children)
|
|
13
|
-
self.reflection.options[:polymorphic] = true
|
|
14
|
-
end
|
|
15
|
-
else
|
|
16
|
-
super(reflection, children)
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def ==(other)
|
|
21
|
-
base_klass == other.base_klass
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|