What’s the current line of thinking wrt patterns/best practices for
remote calls and subsequent page updates?
For instance, let’s say I have a simple link_to_remote call that simple
creates a new comment for a given blog post. On success, I’d like to
indicate that all was well, on failure, I’d like to give some indication
as to why.
Obviously, Rails has some nice (and by nice I mean ‘programmer
friendly’) abstractions for handling this type of functionality but the
myriad of options has left me in a state of paralysis.
That said, I’m seeking to understand the preferred/recommended way to
pull something like this off:
class CommentController < ApplicationController
@comment = Comment.new(params[:comment])
# Should I use RJS here to update the page?
# Should I return some HTML (sans RJS) and use the prototype
# update a DIV?
# Would obviously look to stay consistent here.
# Do I use RJS to update the page?
# Shall I send back a non 2XX status code and use prototype helper
What be the prevailing pattern? Arggh.