I have a validations in mongoid that I want to revert if it fails while saving the error message.
Example
if @thing.update_attributes(params[:thing])
format.html { redirect_to @thing, notice: 'Thing was successfully updated.' }
format.json { head :no_content }
else
#revert the fields that have changed and keep @thing.errors
format.html { render action: "edit" }
format.json { render json: @thing.errors, status: :unprocessable_entity }
end
when I save off the document and reinsert it, it seems to not want to assign @thing.errors = errors
Thanks