0.0
Low commit activity in last 3 years
A long-lived project that still receives updates
Hacks to support Mongoid remove field. Including associations and validations
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

> 4.0, < 11.0
 Project Readme

Mongoid::Suicide Logo

Ruby Gem Version

Provides methods to remove fields from Mongoid models

Installation

Add this line to your application's Gemfile:

gem 'mongoid-suicide'

And then execute:

$ bundle

Or install it yourself as:

$ gem install mongoid-suicide

Usage

Set up a Mongoid::Suicide:

class Person
  include Mongoid::Document
  include Mongoid::Suicide

  field :username, type: String
end

p = Person.first
p.username
=> ...

Remove a field from a document:

Person.remove_field(:username)

p = Person.first
p.username
=> NoMethodError: undefined method `username'

Contributing

  1. Fork it ( https://github.com/mamantoha/mongoid-suicide/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

License and Author

The gem is available as open source under the terms of the MIT License.

Copyright (c) 2015-2024 by Anton Maminov