app/components/katalyst/tables/query/modal_component.rb in katalyst-tables-3.4.3 vs app/components/katalyst/tables/query/modal_component.rb in katalyst-tables-3.4.4
- old
+ new
@@ -62,10 +62,17 @@
[key, collection.model.human_attribute_name(key)]
end
end
def examples_for(key)
- collection.examples_for(key)&.reject { |e| e.value.to_s.blank? } || []
+ collection.examples_for(key).filter_map do |example|
+ case example
+ when Collection::Type::Example
+ example if example.value.to_s.present?
+ else
+ raise ArgumentError, "Invalid example #{example.inspect} for #{collection.model_name}.#{key}"
+ end
+ end
end
def format_value(value)
if /\A[\w.-]*\z/.match?(value.to_s)
value.to_s