-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
Consider the following example
class Organization include Mongoid::Document field :name validates_presence_of :name has_many :members end class Member include Mongoid::Document belongs_to :organization field :name field :email validates_presence_of :organization, :name, :email end org = Organization.create!(name: 'Pipewise') m = Member.new(organization: org, email: 'admin@pipewise.com') m.save(validate: false) # <= returns true as expected m.errors.present? # <= returns true, while expected false
This presents a problem for controllers using the Responder. The Responder looks at the model errors to decide whether to return a happy response or 422. In this case we get 422 even though the model has been persisted.