Sha256: fc61ffdc3395a7f67d0f35de9c72f202337dda6e850480dc8baf3b67dfcbd399

Contents?: true

Size: 593 Bytes

Versions: 4

Compression:

Stored size: 593 Bytes

Contents

class Article < ActiveRecord::Base
  belongs_to :user
  has_many :comments, dependent: :destroy
  has_many :commented_users, through: :comments, source: :user
  validates :user, presence: true

  acts_as_notifiable :users,
    targets: ->(article, key) { User.all.to_a - [article.user] },
    notifier: :user,
    email_allowed: true,
    printable_name: ->(article) { "new article \"#{article.title}\"" },
    dependent_notifications: :delete_all
  acts_as_notification_group printable_name: ->(article) { "article \"#{article.title}\"" }

  def author?(user)
    self.user == user
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
activity_notification-1.1.0 spec/rails_app/app/models/article.rb
activity_notification-1.0.2 spec/rails_app/app/models/article.rb
activity_notification-1.0.1 spec/rails_app/app/models/article.rb
activity_notification-1.0.0 spec/rails_app/app/models/article.rb