1
0
Fork 0
mirror of https://github.com/activerecord-hackery/ransack.git synced 2022-11-09 13:47:45 -05:00

Exclude "host" from params sent to url generator (#1317)

This commit is contained in:
David Rodríguez 2022-05-08 10:02:20 +02:00 committed by GitHub
parent db4ed2cc0f
commit 0c5078c462
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View file

@ -130,7 +130,7 @@ module Ransack
def url_options
@params.merge(
@options.except(:class, :data).merge(
@options.except(:class, :data, :host).merge(
@search.context.search_key => search_and_sort_params))
end

View file

@ -770,6 +770,18 @@ module Ransack
it { should_not match /people\?data%5Bturbo_action%5D=advance/ }
end
describe "#sort_link with host option" do
subject { @controller.view_context
.sort_link(
[:main_app, Person.ransack(sorts: ['name desc'])],
:name,
host: 'foo', controller: 'people'
)
}
it { should match /href="\/people\?q/ }
it { should_not match /href=".*foo/ }
end
describe '#search_form_for with default format' do
subject { @controller.view_context
.search_form_for(Person.ransack) {} }