app/models/message.rb in has_messages-0.2.0 vs app/models/message.rb in has_messages-0.3.0
- old
+ new
@@ -9,20 +9,20 @@
#
# == Interacting with the message
#
# In order to perform actions on the message, such as queueing or delivering,
# you should always use the associated event action:
-# * +queue!+ - Queues the message so that you can send it in a separate process
-# * +deliver!+ - Sends the message to all of the recipients
+# * +queue+ - Queues the message so that you can send it in a separate process
+# * +deliver+ - Sends the message to all of the recipients
#
# == Hiding messages
#
# Although you can delete a message, it will also delete it from the inbox of all
# the message's recipients. Instead, you can hide messages from users with the
# following actions:
-# * +hide!+ -Hides the message from the sender's inbox
-# * +unhide!+ - Makes the message visible again
+# * +hide+ -Hides the message from the sender's inbox
+# * +unhide+ - Makes the message visible again
class Message < ActiveRecord::Base
belongs_to :sender,
:polymorphic => true
has_many :recipients,
:class_name => 'MessageRecipient',
@@ -100,15 +100,15 @@
message.bcc(bcc)
message
end
# Hides the message from the sender's inbox
- def hide!
+ def hide
update_attribute(:hidden_at, Time.now)
end
# Makes the message visible in the sender's inbox
- def unhide!
+ def unhide
update_attribute(:hidden_at, nil)
end
# Is this message still hidden from the sender's inbox?
def hidden?