Merge pull request #1454 from Shopify/default-filter-with-to-liquid-value

utilize input's to_liquid_value on default filter
This commit is contained in:
Michael Go
2021-06-14 15:43:56 -03:00
committed by GitHub
2 changed files with 5 additions and 1 deletions
+1 -1
View File
@@ -468,7 +468,7 @@ module Liquid
#
def default(input, default_value = '', options = {})
options = {} unless options.is_a?(Hash)
false_check = options['allow_false'] ? input.nil? : !input
false_check = options['allow_false'] ? input.nil? : !Liquid::Utils.to_liquid_value(input)
false_check || (input.respond_to?(:empty?) && input.empty?) ? default_value : input
end