lib/alba/resource.rb in alba-2.0.0 vs lib/alba/resource.rb in alba-2.0.1

- old
+ new

@@ -1,7 +1,8 @@ require_relative 'association' require_relative 'conditional_attribute' +require_relative 'constants' require_relative 'typed_attribute' require_relative 'nested_attribute' require_relative 'deprecation' require_relative 'layout' @@ -213,11 +214,11 @@ end def set_key_and_attribute_body_from(object, key, attribute, hash) key = transform_key(key) value = fetch_attribute(object, key, attribute) - hash[key] = value unless value == ConditionalAttribute::CONDITION_UNMET + hash[key] = value unless value == Alba::REMOVE_KEY end def handle_error(error, object, key, attribute, hash) on_error = @_on_error || :raise case on_error # rubocop:disable Style/MissingElse @@ -269,10 +270,10 @@ @_on_nil end def yield_if_within(association_name) within = check_within(association_name) - yield(within) if within + within ? yield(within) : Alba::REMOVE_KEY end def check_within(association_name) case @within when WITHIN_DEFAULT then WITHIN_DEFAULT # Default value, doesn't check within tree