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

**URL:** https://meta.discourse.org/t/why-does-calling-super-in-postserializer-raw-cause-a-500-error-while-calling-object-raw-works/390455
**Category:** Development
**Created:** [4 בדצמבר,‏ 2025,‏ 9:24pm UTC](https://meta.discourse.org/t/why-does-calling-super-in-postserializer-raw-cause-a-500-error-while-calling-object-raw-works/390455 "2025-12-04T21:24:41Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![copymonopoly](https://avatars.discourse-cdn.com/v4/letter/c/4491bb/32.png) [@copymonopoly](https://meta.discourse.org/u/copymonopoly)
#### Post date: [5 בדצמבר,‏ 2025,‏ 6:24pm UTC](https://meta.discourse.org/t/why-does-calling-super-in-postserializer-raw-cause-a-500-error-while-calling-object-raw-works/390455/5 "2025-12-05T18:24:56Z")

</div>

Thanks for the explanation!  
You’re right — reopening `::PostSerializer` was the issue. After switching to `prepend`, everything works as expected.

I’m now using this module:

```plaintext
module PostSerializerExtension
  def raw
    if scope.can_edit?(object)
      super
    else
      object.raw&.truncate(300)
    end
  end
end

reloadable_patch do
  require_dependency "post_serializer"
  ::PostSerializer.prepend(::PostSerializerExtension)
end

```

This works perfectly on my side. Thanks again for the guidance!

---

_[View the full topic](https://meta.discourse.org/t/why-does-calling-super-in-postserializer-raw-cause-a-500-error-while-calling-object-raw-works/390455)._
