# The `title` methods in each model are so similar it feels like they should be able to be shared.
# Normally this would be a good excuse to use a Concern, but is that even possible?
class Message < ApplicationRecord
def title
subject
end
end
class Comment < ApplicationRecord
def title
subject.truncate(20)
end
end
Last active
June 26, 2021 15:55
-
-
Save stevepolitodesign/04104bf4f71b4821f552f5b337e693d9 to your computer and use it in GitHub Desktop.
How to share a similar method between two models?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment