Why does calling super in PostSerializer#raw cause a 500 error while calling object.raw works?

This is a feature of Ruby. When you use class ::PostSerializer, you are overriding the definition in the original class instead of inheriting from it. Because you are not inheriting from PostSerializer, super cannot find the corresponding method.

You should use prepend instead of reopening an already defined class.

4 Likes