Rails: NameError (uninitialized constant UserSerializer) error message
How to solve fast_jsonapi serializer error?
·Jul 27, 2022·
2 min read
Play this article
fast_jsonapi is a a lightning fast JSON:API serializer for Ruby Objects. Its github page can be accessed here.
The project is no longer maintained, but you might end up using it in some applications.
This is the usual error message:
NameError (uninitialized constant UserSerializer)
None of the following tests worked:
- Leave terminal and open it again;
- Open a new tab;
- Open the terminal on VS Code;
- Open the terminal on Linux console;
For me, it worked to stop spring, which is a Rails application preloader.
- Exit Rails console
- Stop the
springRails application preloader
By the way, you can see all the available spring commands by using
- Run the test command
Here, I tried:
UserSerializer.new( User.first ).serializable_hash
or just type
It'll return the class itself
springis still working
In case you're a
springfreak (Just kidding lol),
Leave the terminal
and there you go,
spring is fine
That's all. Hope you guys liked it. Let me know if you need any help.