From 5d61223b3bf536100c2332d16c2436c69a31c01b Mon Sep 17 00:00:00 2001 From: Sergio Cambra Date: Thu, 21 Jun 2018 11:48:11 +0200 Subject: [PATCH] remove Date cast extension, unneeded because datepicker value is always converted with condition_value_for_datetime --- CHANGELOG | 1 + lib/active_scaffold/helpers/list_column_helpers.rb | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 1bc5eeaf5a..1efb9a3fd8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,7 @@ = 3.5.x - Load chosen on turbolinks:load event +- Fix association.blank? when associated_limit=0 and includes=nil = 3.5.1 - Fix set false options for date picker diff --git a/lib/active_scaffold/helpers/list_column_helpers.rb b/lib/active_scaffold/helpers/list_column_helpers.rb index 6b848df172..4433de685b 100644 --- a/lib/active_scaffold/helpers/list_column_helpers.rb +++ b/lib/active_scaffold/helpers/list_column_helpers.rb @@ -253,7 +253,8 @@ def cache_association(association, column, size) # load at least one record more, is needed to display '...' association.target = association.reader.limit(column.associated_limit + 1).select(column.select_associated_columns || "#{association.klass.quoted_table_name}.*").to_a elsif @cache_associations - association.target = [] + # set array with at least one element if size > 0, so blank? or present? works, saving [nil] may cause exceptions + association.target = size.to_i.zero? ? [] : [association.klass.new] end end