LazyAssociation#object should not reevaluate reflection values

This commit is contained in:
Nikita Sokolov 2018-12-29 10:42:25 +03:00
parent 17d0e6bdb7
commit a39794df5b
2 changed files with 3 additions and 1 deletions

View File

@ -8,6 +8,7 @@ Features:
Fixes:
- [#2307](https://github.com/rails-api/active_model_serializers/pull/2307) Falsey attribute values should not be reevaluated.
Misc:

View File

@ -11,7 +11,8 @@ module ActiveModel
end
def object
@object ||= reflection.value(
return @object if defined?(@object)
@object = reflection.value(
association_options.fetch(:parent_serializer),
association_options.fetch(:include_slice)
)