Sha256: 770e1633dce274f9a4947dfc82231e68872527011da5a4dcd4008d642adea3cd

Contents?: true

Size: 647 Bytes

Versions: 1

Compression:

Stored size: 647 Bytes

Contents

# Demonstrates the `only` and `ignore` attributes, among other things.
class Article < ActiveRecord::Base
  has_paper_trail(
    ignore: [
      :title, {
        abstract: proc { |obj|
          ["ignore abstract", "Other abstract"].include? obj.abstract
        }
      }
    ],
    only: [:content, { abstract: proc { |obj| obj.abstract.present? } }],
    skip: [:file_upload],
    meta: {
      answer: 42,
      action: :action_data_provider_method,
      question: proc { "31 + 11 = #{31 + 11}" },
      article_id: proc { |article| article.id },
      title: :title
    }
  )

  def action_data_provider_method
    object_id.to_s
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
paper_trail-7.1.0 spec/dummy_app/app/models/article.rb