I have created a pre_validate method and put it in :before_filter in
selected. I am using a boolean variable as a flag that turns to true
when a value is selected and I pass this variable using :with and
respond_to do |format|
render :update do |page|
if params[:time_selected] == 'false'
page.replace_html 'error', "You must select a time."
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?