How to resolve issue where Serializer are not being recognized in rails console

Khemlall Mangal
1 min readMar 9, 2021

--

I ran into an issue where i was trying to follow a tutorial using fast-json api in my rails app. I was trying to test out the json format in database via console and i kept getting (uninitialized constant UserSerializer). The resolution was to stop spring and then try again and it should work.

I found this at stackoverflow which helped me: https://stackoverflow.com/questions/60688928/rails-nameerror-uninitialized-constant-userserializer

kept getting unitialized constant error.

Here’s how I solved it:

Exit the rails console, if you’re still inside it:

exit

Stop the spring Rails application preloader:

spring stop

Enter rails console in development environment again:

rails console

Run the command again:

ArticleSerializer

It gives an output of this sort:

#<ActiveRecord::Relation [#<User id: 3, first_name: "Promise", last_name: "My last name", username: "myusername", password_digest: [FILTERED], email: "myemail@gmail.com", phone: "002037363", address: "my address", created_at: "2020-03-14 18:36:31", updated_at: "2020-03-14 18:36:31">]>

That’s all.

--

--

Khemlall Mangal

I am a passionate coder, QA Engineer, and someone who enjoys the outdoors.