You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The above code has a few more edge cases that are missed, specifically with the second two cases in the outer conditional where the attribute is not backed by a database column. The next two cases must account for the same issue (attribute can either be a boolean where false is not 'blank', it's a set value, but false.nil? == true, or a collection that is empty via blank?).
This whole thing should be cleaned up, with perhaps a few comments explaining each case.
@chrisarcand currently working on that
it seems you've not tested the false.nil? case as replacing nil? with blank? line 167 doesn't break tests
I'll add that.
Or maybe you did, but weird that the tests don't break then
default_value_for/lib/default_value_for.rb
Lines 159 to 170 in c52d291
The above code has a few more edge cases that are missed, specifically with the second two cases in the outer conditional where the attribute is not backed by a database column. The next two cases must account for the same issue (attribute can either be a boolean where
false
is not 'blank', it's a set value, butfalse.nil? == true
, or a collection that is empty viablank?
).This whole thing should be cleaned up, with perhaps a few comments explaining each case.
See d155ba7#commitcomment-30274475
cc/ @romaind
The text was updated successfully, but these errors were encountered: