diff --git a/has_messages.gemspec b/has_messages.gemspec index 0af6226..2dce20c 100644 --- a/has_messages.gemspec +++ b/has_messages.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = %q{has_messages} - s.version = "0.4.3.6-topics" + s.version = "0.4.3.7" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Aaron Pfeifer"] diff --git a/lib/has_messages.rb b/lib/has_messages.rb index 57a0e75..56d677e 100644 --- a/lib/has_messages.rb +++ b/lib/has_messages.rb @@ -2,6 +2,8 @@ # Adds a generic implementation for sending messages between users module HasMessages + MESSAGE_TOPIC_FIELD_DELIMITER = "-" + module MacroMethods # Creates the following message associations: # * +messages+ - Messages that were composed and are visible to the owner. @@ -90,6 +92,10 @@ def topical_messages_for(receiver, recipient_state = nil) def unread_topical_messages_for(receiver) topical_messages_for(receiver, :unread) end + + def message_topic_field + "#{self.class.to_s}#{HasMessages::MESSAGE_TOPIC_FIELD_DELIMITER}#{self.id}" + end end end