Enhanced AJAX handling for Rails apps