当使用位置响应时,它会忽略验证错误并重定向到指定位置。这是预期的行为吗?
我检查了响应器模块,它检查模型上是否有任何错误。我检查了模型,它在 @solution 对象中包含验证错误。我在这里想念什么?
控制器:
def create
@problem = Problem.find(params[:problem_id])
@solution = @problem.solutions.build params[:solution]
@solution.save
respond_with(@solution, :location => detail_problem_solution_path(@problem, @solution)
end
模型:
validates :body, :presence => true, :unless => :reference
参考是真还是假。