Created
September 23, 2012 03:04
-
-
Save teaforthecat/3768668 to your computer and use it in GitHub Desktop.
Showing validation/error reporting problem with associated Mongoid models
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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