Skip to content

Getting null id #2489

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
abhiroopABC opened this issue Apr 9, 2025 · 0 comments
Open

Getting null id #2489

abhiroopABC opened this issue Apr 9, 2025 · 0 comments

Comments

@abhiroopABC
Copy link

abhiroopABC commented Apr 9, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant