best practices for conflicting method names between ActiveRecord model and its serializer in Rails 7.1?
Can someone help me understand I'm working on a project and hit a roadblock. I’m working with an scenario where I have an ActiveRecord model called `User` that has a method called `full_name` which concatenates the first and last names. However, in my associated `UserSerializer`, I also have a `full_name` method aimed at formatting the output for JSON. This seems to cause a conflict when I try to serialize a `User` object, resulting in the following behavior: `undefined method 'full_name' for #<User:0x00007fa2c6e19588>`. Here’s the relevant part of my `User` model: ```ruby class User < ApplicationRecord def full_name "#{first_name} #{last_name}" end end ``` And here’s my `UserSerializer`: ```ruby class UserSerializer < ActiveModel::Serializer attributes :id, :full_name def full_name "User: #{object.full_name}" end end ``` I’ve tried renaming the method in the `UserSerializer` to `formatted_full_name`, but that didn’t resolve the conflict, and the serializer still appears to call the model’s method instead. I’ve also checked if there’s any other method in the `User` class that might be interfering, but everything seems clean. I’m running Ruby on Rails 7.1 with ActiveModel Serializers 0.10.12. How can I resolve this method name conflict and ensure that my serializer correctly formats the output? What am I doing wrong? Is this even possible?