Permalink
Browse files

Change after_create callback

  • Loading branch information...
1 parent 4e2b9fa commit 5a56ae15590e1f71e640ddd68fdb4dbed70c8206 @atd atd committed Jul 13, 2011
Showing with 4 additions and 4 deletions.
  1. +4 −4 app/models/contact.rb
View
@@ -57,7 +57,7 @@ class Contact < ActiveRecord::Base
validates_uniqueness_of :receiver_id, :scope => :sender_id
after_create :set_inverse
- after_create :send_message
+ after_save :send_message
def sender_subject
sender.try(:subject)
@@ -146,9 +146,9 @@ def remove_follower(ids)
# Send a message to the contact receiver
def send_message
- if message.present?
- sender.send_message(receiver, message, I18n.t("activity.verb.#{ verb }.#{ receiver.subject_type }.message", :name => sender.name))
- end
+ return if message.blank?
+
+ sender.send_message(receiver, message, I18n.t("activity.verb.#{ verb }.#{ receiver.subject_type }.message", :name => sender.name))
end
def set_inverse

0 comments on commit 5a56ae1

Please sign in to comment.