From 484722d5ae4d9bd45412fafa7d9acec98528a4b1 Mon Sep 17 00:00:00 2001 From: John DeSilva Date: Sun, 24 Mar 2024 18:59:45 -0400 Subject: [PATCH 1/2] Remove ActionView::Helpers::Tags::Base#value monkey patch --- lib/ransack/helpers/form_builder.rb | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/lib/ransack/helpers/form_builder.rb b/lib/ransack/helpers/form_builder.rb index 0f9d826f..5b0c12b2 100644 --- a/lib/ransack/helpers/form_builder.rb +++ b/lib/ransack/helpers/form_builder.rb @@ -1,23 +1,5 @@ require 'action_view' -module ActionView::Helpers::Tags - # TODO: Find a better way to solve this issue! - # This patch is needed since this Rails commit: - # https://github.com/rails/rails/commit/c1a118a - class Base - private - if defined? ::ActiveRecord - def value - if @allow_method_names_outside_object - object.send @method_name if object && object.respond_to?(@method_name, true) - else - object.send @method_name if object - end - end - end - end -end - RANSACK_FORM_BUILDER = 'RANSACK_FORM_BUILDER'.freeze require 'simple_form' if From bfc8b8a45286b2bae38c1796c86bf49d3a1c9743 Mon Sep 17 00:00:00 2001 From: John DeSilva Date: Sun, 24 Mar 2024 19:40:45 -0400 Subject: [PATCH 2/2] Prevent calling #p on object --- lib/ransack/helpers/form_builder.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ransack/helpers/form_builder.rb b/lib/ransack/helpers/form_builder.rb index 5b0c12b2..15364d0b 100644 --- a/lib/ransack/helpers/form_builder.rb +++ b/lib/ransack/helpers/form_builder.rb @@ -112,6 +112,7 @@ def search_fields(name, args, block) def predicate_select(options = {}, html_options = {}) options[:compounds] = true if options[:compounds].nil? + options[:selected] ||= nil default = options.delete(:default) || Constants::CONT keys =