Sha256: 74c0954173e979b6229d355392f6708ed10cfca7646013ac3d77c1611e4ef6fd

Contents?: true

Size: 265 Bytes

Versions: 38

Compression:

Stored size: 265 Bytes

Contents

class Oscar
  include Mongoid::Document
  field :title, type: String
  field :destroy_after_save, type: Mongoid::Boolean, default: false
  before_save :complain

  def complain
    if destroy_after_save?
      destroy
    else
      throw(:abort)
    end
  end
end

Version data entries

38 entries across 36 versions & 2 rubygems

Version Path
mongoid-7.0.13 spec/app/models/oscar.rb
mongoid-7.0.12 spec/app/models/oscar.rb
mongoid-6.4.8 spec/app/models/oscar.rb
mongoid-7.0.11 spec/app/models/oscar.rb
mongoid-7.0.10 spec/app/models/oscar.rb
mongoid-6.4.7 spec/app/models/oscar.rb
mongoid-6.4.5 spec/app/models/oscar.rb
mongoid-7.0.8 spec/app/models/oscar.rb
mongoid-7.0.7 spec/app/models/oscar.rb
mongoid-7.0.6 spec/app/models/oscar.rb
mongoid-7.0.5 spec/app/models/oscar.rb
mongoid-7.0.4 spec/app/models/oscar.rb
mongoid-6.4.4 spec/app/models/oscar.rb
mongoid-7.0.3 spec/app/models/oscar.rb
mongoid-6.4.2 spec/app/models/oscar.rb
mongoid-7.0.2 spec/app/models/oscar.rb
mongoid-7.0.1 spec/app/models/oscar.rb
mongoid-6.4.1 spec/app/models/oscar.rb
tdiary-5.0.8 vendor/bundle/gems/mongoid-6.4.0/spec/app/models/oscar.rb
mongoid-7.0.0 spec/app/models/oscar.rb