Sha256: 566a451ddca8c8f74ccb1aa1a59270e1fd2be9c12dfa2a6246f5aec0b4b5205f

Contents?: true

Size: 533 Bytes

Versions: 1

Compression:

Stored size: 533 Bytes

Contents

class Comment < ActiveRecord::Base
  belongs_to :article
  belongs_to :user
  validates :article, presence: true
  validates :user, presence: true

  acts_as_notifiable :users,
    targets: ->(comment, key) {
      (comment.article.commented_users.to_a - [comment.user] + [comment.article.user]).uniq
    },
    group: :article,
    notifier: :user,
    email_allowed: true,
    parameters: { test_default_param: '1' },
    notifiable_path: :article_notifiable_path

  def article_notifiable_path
    article_path(article)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activity_notification-0.0.10 spec/rails_app/app/models/comment.rb