Sha256: d2ac3386003a5069b60bcae30c2c14efbd48a45c91cc01d31c12a4d9ce9f8fcf

Contents?: true

Size: 285 Bytes

Versions: 2

Compression:

Stored size: 285 Bytes

Contents

class Draft < ActiveRecord::Base
  belongs_to :user, polymorphic: true
  belongs_to :parent, polymorphic: true

  validates_presence_of :data, :target_type

  def restore
    target_type.constantize.from_draft(self)
  end

  def self.restore_all
    find_each.map(&:restore)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
drafting-0.5.1 lib/drafting/draft.rb
drafting-0.5.0 lib/drafting/draft.rb