Skip to content

Instantly share code, notes, and snippets.

@mikespokefire
Created September 24, 2012 08:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikespokefire/3774881 to your computer and use it in GitHub Desktop.
Save mikespokefire/3774881 to your computer and use it in GitHub Desktop.
Marking fields as dirty in Mongoid and ActiveRecord
class Muppet
include Mongoid::Document
field :tags, Array
end
m = Muppet.new(:biography => ['a', 'b', 'c'])
m.save
m.tags.pop
m.tags_will_change!
m.save # Now tags will change as it is marked as dirty!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment