Sha256: d997377c84b43e924184c42282c9f8e44aa4e52548c58de8467f7c8196472f64

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

class Message < ApplicationRecord

  # ---------------------------------------- Plugins

  # Test that the basics work with the model config. All other features and
  # variations are tested using the bulk config.
  notify_on :create,
            :to => :user,
            :from => :author,
            :message => '{author.email} sent you a message.',
            :link => 'message_path(:self)',
            :email => true

  # ---------------------------------------- Attributes

  attr_accessor :delayed

  # ---------------------------------------- Associations

  belongs_to :user
  belongs_to :author, :class_name => 'User'

  # ---------------------------------------- Validations

  validates :user, :author, :content, :presence => true

  # ---------------------------------------- Instance Methods

  def delayed?
    content.start_with?('[DELAYED]')
  end

  def skip?
    content.start_with?('[SKIP]')
  end

  def pdf_filename
    'myfile.pdf'
  end

  def pdf_file
    @pdf_file ||= open('http://loremflickr.com/200/200')
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
notify_on-1.0.5 spec/dummy/app/models/message.rb
notify_on-1.0.4 spec/dummy/app/models/message.rb
notify_on-1.0.3 spec/dummy/app/models/message.rb
notify_on-1.0.2 spec/dummy/app/models/message.rb