when building a web application. This means it is not a single piece in an overall puzzle of building a web application, but an end-to-end solution. This makes Angular opinionated about how a CRUD application should be built.” or Angular
def create post = Post.find(params[:post_id]) @comment = post.comments.create!(params[:comment]) respond_with(@comment) do |format| format.html { redirect_to post } end end private def self.responder XhrResponder end end
end # xhr the "format" when you request html but do so via AJAX. # def respond if xhr? && format == :html method = "to_xhr" else method = "to_#{format}" end respond_to?(method) ? send(method) : to_format end # render the appropriate partial for the resource # def to_xhr controller.default_render(@resource, options.merge(:partial => true)) end end