def pre_validate respond_to do |format| format.js do render :update do |page| if params[:time_selected] == 'false' page.replace_html 'error', "You must select a time." end end end end end
This way i can render the error using ajax. If there are seemingly no problems with this route, my question is this: I also have a custom validation method in my model to check if there is a time conflict, but this only gets called after I try object.save, so I was wondering if it there are any other disadvantages to putting this custom validation into a similar :pre_filter function other than only being able to render one error at once. It seems like it might be a waste to have to create an object only to have it fail. Why not check if it fails in this particular instance first?