Skip to content

Instantly share code, notes, and snippets.

@teaforthecat
Created September 23, 2012 03:04
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 teaforthecat/3768668 to your computer and use it in GitHub Desktop.
Save teaforthecat/3768668 to your computer and use it in GitHub Desktop.
Showing validation/error reporting problem with associated Mongoid models
class Artist
include Mongoid::Document
has_many :history_events, autosave: true, validate: true
end
class HistoryEvent
include Mongoid::Document
belongs_to :artist
validates_presence_of :headline
end
# when updating artist and a new history event has a blank headline, the error is reported properly
# when updating artist and an existing history events' headline is removed, the document does not save, but the error is not reported.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment