Skip to content

Commit c6c3927

Browse files
authored
Merge pull request #2307 from faucct/bugfix/double-evaluation-of-object
Reevaluation of object
2 parents 9939d54 + a39794d commit c6c3927

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Features:
88

99
Fixes:
1010

11+
- [#2307](https://github.com/rails-api/active_model_serializers/pull/2307) Falsey attribute values should not be reevaluated.
1112

1213
Misc:
1314

lib/active_model/serializer/lazy_association.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ def reflection_options
1313
end
1414

1515
def object
16-
@object ||= reflection.value(
16+
return @object if defined?(@object)
17+
@object = reflection.value(
1718
association_options.fetch(:parent_serializer),
1819
association_options.fetch(:include_slice)
1920
)

0 commit comments

Comments
 (0)