Skip to content

ActiveType::Object loses value in Rails cache #204

@0llirocks

Description

@0llirocks

active_type: 2.6.2
rails: 8.0.2
ruby: 3.3.4

class User < ActiveType::Object
    attribute :firstname
end

When I pass a object or an array of objects into the Rails.cache it seems to work in the first place but once I try to read the values via the corresponding cache key, the returned value has all attributes set to nil. This also applies to arrays, all objects in that array are nilled.

Rails.cache.fetch('cache_key') { User.create(firstname: 'test')  } # => #<User firstname: "test">
Rails.cache.fetch('cache_key') # => #<User firstname: "nil">

Any idea what's going on here?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions