When using location in respond with, it is ignoring validation errors and redirecting to the specified location. Is this expected behavior?
I checked in the responder module that it checking if there are any errors on the model. I inspected the model and it contains validation errors in the @solution object. What am I missing here?
controller:
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
model:
validates :body, :presence => true, :unless => :reference
reference is true or false false.
The only way I was able to solve is this: