Skip to content

Getting null id #2489

Open
Open
@abhiroopABC

Description

@abhiroopABC

When the user object is serialized I am getting id as null and rest all the data is correct. I am using active_model_serializers version 0.10.13

class UserSerializer < ActiveModelSerializers::Model
attributes :id, :first_name, :last_name, :username
end

Getting id as null when checking in the pry using object.id, but getting correct data using object[:id] . I am not sure what could be the reason and it is happening after upgrading rails 5.2 to 6.1. Another catch is, I am getting this error in a specific environment, other than local and stage.
ruby version - 2.7.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions