Class: Messaging::Adapters::Postgres::Category
- Inherits:
-
Object
- Object
- Messaging::Adapters::Postgres::Category
- Extended by:
- Dry::Initializer
- Defined in:
- lib/messaging/adapters/postgres/category.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
- #inspect ⇒ Object
-
#messages ⇒ ActiveRecord::Relation
Access to all messages in the category sorted by created_at.
- #to_s ⇒ Object
Class Method Details
.table_name_for(name) ⇒ Object
10 11 12 |
# File 'lib/messaging/adapters/postgres/category.rb', line 10 def self.table_name_for(name) name.parameterize(separator: '_') end |
Instance Method Details
#inspect ⇒ Object
20 21 22 |
# File 'lib/messaging/adapters/postgres/category.rb', line 20 def inspect "#<Category: #{name}>" end |
#messages ⇒ ActiveRecord::Relation
Access to all messages in the category sorted by created_at
16 17 18 |
# File 'lib/messaging/adapters/postgres/category.rb', line 16 def SerializedMessage.where(stream_category: name).order(:created_at) end |
#to_s ⇒ Object
24 25 26 |
# File 'lib/messaging/adapters/postgres/category.rb', line 24 def to_s name end |