app/models/refine/inline/criteria/input.rb in refine-rails-2.11.11 vs app/models/refine/inline/criteria/input.rb in refine-rails-2.11.12

- old
+ new

@@ -16,10 +16,11 @@ :value1, :value2, :count_refinement, :date_refinement + def attributes { clause: clause, date1: date1, date2: date2, @@ -32,10 +33,15 @@ count_refinement: count_refinement_attributes.presence, date_refinement: date_refinement_attributes.presence }.compact end + def attributes=(attrs = {}) + super(attrs) + strip_values + end + def count_refinement @count_refinement ||= Refine::Inline::Criteria::NumericRefinement.new end def count_refinement_attributes @@ -58,7 +64,14 @@ date_refinement.attributes = attrs.to_h end def selected=(value) @selected = Array.wrap(value) + end + + def strip_values + [:value, :value1, :value2].each do |attr| + current_value = send(attr) + send("#{attr}=", current_value.strip) if current_value.present? + end end end