Using flash for javascript messages
Using flash[:notice] doesn’t work so well with AJAX calls. Adding a “js_notice” key to flash has helped me in several places.
respond_to do |format|
if @question_monitor.save
format.js {
flash[:js_notice] = "You will now be alerted to any new activity on this question."
}
else
format.js {
flash[:js_notice] = "There was a problem in trying to monitor this question"
}
end
end