<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>app/views/comments/create.js.erb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -10,6 +10,23 @@ class CommentsController &lt; ApplicationController
       redirect_to post_path(resource.post), :status =&gt; :moved_permanently
     end
   end
+  
+  response_for :create do |format|
+    if resource_saved?
+      format.html do
+        redirect_to post_path(resource.post), :status =&gt; :moved_permanently
+      end
+      format.js
+    else
+      format.html do
+        render :action =&gt; &quot;new&quot;
+      end
+      format.js do
+        # if the jquery validation is working, this should never happen
+        render :text =&gt; &quot;some error message&quot;
+      end
+    end
+  end
 
   private
 </diff>
      <filename>app/controllers/comments_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,10 +6,12 @@
 
 &lt;p&gt;&lt;%= link_to &quot;Edit&quot;, edit_post_path(@post) %&gt; or &lt;%= link_to &quot;Delete&quot;, post_path(@post), :method =&gt; :delete %&gt;&lt;/p&gt;
 
+&lt;div id=&quot;comments&quot;&gt;
 &lt;% unless @post.comments.blank? %&gt;
 &lt;h3&gt;Comments&lt;/h3&gt;
 &lt;%= render :partial =&gt; @post.comments %&gt;
 &lt;% end %&gt;
+&lt;/div&gt;
 
 &lt;h3&gt;New comment&lt;/h3&gt;
 &lt;% form_for([@post, Comment.new], :url =&gt; post_comments_path(@post)) do |f| %&gt;</diff>
      <filename>app/views/posts/show.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -28,15 +28,26 @@ $(document).ready(function(){
     });
   });
 
+	// the ajax comments
+	$(&quot;#new_comment&quot;).submitWithAjax();
+
 });
 
 jQuery.ajaxSetup({ 
   'beforeSend': function(xhr) {xhr.setRequestHeader(&quot;Accept&quot;,
     &quot;text/javascript&quot;)} 
-})
+});
 
 jQuery.validator.setDefaults({
   errorPlacement: function(error, element) {
        error.insertBefore(element);
      }
-});
\ No newline at end of file
+});
+
+jQuery.fn.submitWithAjax = function() {
+  this.submit(function() {
+    $.post(this.action, $(this).serialize(), null, &quot;script&quot;);
+    return false;
+  })
+  return this;
+};
\ No newline at end of file</diff>
      <filename>public/javascripts/application.js</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>d64729b13502149afb775a610d64c21caabc8ad3</id>
    </parent>
  </parents>
  <author>
    <name>Patrick Detlefsen</name>
    <email>patrick.detlefsen@gmail.com</email>
  </author>
  <url>http://github.com/andrew/bumble/commit/0696892c2e3df2badfdca89619d1f2841a992035</url>
  <id>0696892c2e3df2badfdca89619d1f2841a992035</id>
  <committed-date>2009-01-08T04:38:17-08:00</committed-date>
  <authored-date>2008-12-21T05:01:26-08:00</authored-date>
  <message>ajax comments. no validation yet.

Signed-off-by: Andrew Nesbitt &lt;andrewnez@gmail.com&gt;</message>
  <tree>16c747e83c156413ee843d798d9a12c014b92f8e</tree>
  <committer>
    <name>Andrew Nesbitt</name>
    <email>andrewnez@gmail.com</email>
  </committer>
</commit>
