Class: Gluttonberg::CommentSubscription
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Gluttonberg::CommentSubscription
- Defined in:
- app/models/gluttonberg/comment_subscription.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.notify_subscribers_of(article, comment) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'app/models/gluttonberg/comment_subscription.rb', line 10 def self.notify_subscribers_of(article , comment) subscribers = self.find(:all , :conditions => {:article_id => article.id}) subscribers.each do |subscriber| unless subscriber. == comment.writer_email Notifier.delay.comment_notification(subscriber , article , comment ) #.deliver # its using delayed job but i am setting sent time immediately comment.notification_sent_at = Time.now comment.save end end end |
Instance Method Details
#generate_reference_hash ⇒ Object
21 22 23 24 25 |
# File 'app/models/gluttonberg/comment_subscription.rb', line 21 def generate_reference_hash unless self.reference_hash self.reference_hash = Digest::SHA1.hexdigest(Time.now.to_s + self. + self.article_id.to_s) end end |