module Messaging module Adapters class Postgres class Category extend Dry::Initializer param :name param :table_name, default: -> { self.class.table_name_for(name) } def self.table_name_for(name) name.parameterize(separator: '_') end # Access to all messages in the category sorted by created_at # @return [ActiveRecord::Relation] def messages SerializedMessage.where(stream_category: name).order(:created_at) end def inspect "#" end def to_s name end end end end end