Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

Commit

Permalink
Added 'message_topic_field' to help with generating unique ids for to…
Browse files Browse the repository at this point in the history
…pic based messaging.
  • Loading branch information
sanjayginde committed Jan 20, 2014
1 parent 647b206 commit 5e8a1a2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion has_messages.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
6 changes: 6 additions & 0 deletions lib/has_messages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 5e8a1a2

Please sign in to comment.