<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>app/models/platform.rb</filename>
    </added>
    <added>
      <filename>app/views/comments/_comment.html.erb</filename>
    </added>
    <added>
      <filename>app/views/comments/_failed_comment.html.erb</filename>
    </added>
    <added>
      <filename>app/views/comments/_new.html.erb</filename>
    </added>
    <added>
      <filename>app/views/comments/_working_comment.html.erb</filename>
    </added>
    <added>
      <filename>db/migrate/20090202151412_create_platforms.rb</filename>
    </added>
    <added>
      <filename>db/migrate/20090202155040_add_various_indexes.rb</filename>
    </added>
    <added>
      <filename>test/unit/platform_test.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -10,6 +10,7 @@ class CodesController &lt; ApplicationController
   
   def show
     @code = Code.find_by_slug_name!(params[:slug_name])
+    @comment = Comment.new
 
   rescue ActiveRecord::RecordNotFound
     @codes = Code.find_with_ferret([&quot;*&quot;, params[:slug_name], &quot;*&quot;].to_s)</diff>
      <filename>app/controllers/codes_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,2 +1,13 @@
 class CommentsController &lt; ApplicationController
+  def create
+    @code = Code.find params[:code_id]
+    @comment = @code.build_comment params[:comment]
+    @comment.save!
+    flash[:notice] = 'Thanks for your comment'
+    redirect_to code_by_slug_path(@code.slug_name)
+    
+  rescue ActiveRecord::RecordInvalid
+    render :template =&gt; 'codes/show'
+    flash[:error] = 'Sorry, unable to save your comment'
+  end
 end</diff>
      <filename>app/controllers/comments_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,2 +1,9 @@
 module CommentsHelper
+  def name_link_for comment
+    if comment.url.blank?
+      h(comment.name) 
+    else
+      &quot;&lt;a href=\&quot;#{h(comment.url)}\&quot;&gt;#{h(comment.name)}&lt;/a&gt;&quot;
+    end
+  end
 end</diff>
      <filename>app/helpers/comments_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,20 +1,10 @@
 class Code &lt; ActiveRecord::Base
-  
-  named_scope :last_thirty_active, :order =&gt; &quot;updated_at DESC&quot;, :limit =&gt; 30
-  
-  validates_uniqueness_of :name, :slug_name
-  validates_presence_of :name, :slug_name
-  
   has_many :authorships
   has_many :authors, :through =&gt; :authorships
-  has_many :comments, :dependent =&gt; :destroy
+  has_many :comments, :dependent =&gt; :destroy, :order =&gt; 'created_at desc'
   has_many :working_comments, :class_name =&gt; 'Comment', :conditions =&gt; { :works_for_me =&gt; true }
   has_many :failure_comments, :class_name =&gt; 'Comment', :conditions =&gt; { :works_for_me =&gt; false }
   
-  acts_as_ferret :fields =&gt; [:name, :description, :homepage, :rubyforge, :github, :slug_name]
-  
-  before_validation_on_create :set_slug_name
-  
   def works?
     has_no_failure_comments? &amp;&amp; has_working_comments?
   end
@@ -43,6 +33,13 @@ class Code &lt; ActiveRecord::Base
   
 private
   
+  validates_uniqueness_of :name, :slug_name
+  validates_presence_of :name, :slug_name
+  
+  before_validation_on_create :set_slug_name
+  
+  acts_as_ferret :fields =&gt; [:name, :description, :homepage, :rubyforge, :github, :slug_name]
+  
   def set_slug_name
     self.slug_name = slug_name_from_name || self.rubyforge
   end</diff>
      <filename>app/models/code.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,8 @@
 class Comment &lt; ActiveRecord::Base
   belongs_to :code
+  belongs_to :platform
+  
+private
+  validates_presence_of :code
+  validates_presence_of :platform
 end</diff>
      <filename>app/models/comment.rb</filename>
    </modified>
    <modified>
      <diff>@@ -10,4 +10,13 @@
 
 &lt;p class=&quot;authors&quot;&gt;
   &lt;%= h @code.author_names %&gt;
-&lt;/p&gt;
\ No newline at end of file
+&lt;/p&gt;
+
+&lt;p&gt;&lt;%= link_to_function 'add a comment &amp;rarr;', visual_effect(:toggle_blind, 'new-comment-form') %&gt; &lt;/p&gt;
+&lt;div id=&quot;new-comment-form&quot; style=&quot;display:none&quot;&gt;
+  &lt;%= render :partial =&gt; 'comments/new', :locals =&gt; { :code =&gt; @code } %&gt;
+&lt;/div&gt;
+
+
+&lt;%= render :partial =&gt; 'comments/comment', :collection =&gt; @code.comments %&gt;
+</diff>
      <filename>app/views/codes/show.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -29,6 +29,9 @@
     &lt;% unless flash[:notice].blank? %&gt;
       &lt;div id=&quot;flash_notice&quot;&gt; &lt;%= flash[:notice] %&gt; &lt;/div&gt;
     &lt;% end %&gt;
+    &lt;% unless flash[:error].blank? %&gt;
+      &lt;div id=&quot;flash_error&quot;&gt; &lt;%= flash[:error] %&gt; &lt;/div&gt;
+    &lt;% end %&gt;
     &amp;nbsp; 
     &lt;% form_tag codes_path, :method =&gt; :get, :id =&gt; 'search-form' do %&gt;
       &lt;%= text_field_tag :search, params[:search] %&gt; &lt;%= submit_tag 'Search &amp;rarr;', :disable_with =&gt; 'searching....' %&gt;</diff>
      <filename>app/views/layouts/isitruby19.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 class CreateCodes &lt; ActiveRecord::Migration
   def self.up
     create_table :codes do |t|
-      t.string :name, :description, :homepage, :rubyforge, :github, :type
+      t.string :name, :description, :homepage, :rubyforge, :github, :type, :slug_name
       t.decimal :latest_version
       t.timestamps
     end</diff>
      <filename>db/migrate/20090131234053_create_codes.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,14 @@
 class CreateComments &lt; ActiveRecord::Migration
   def self.up
     create_table :comments do |t|
-      t.references :code, :user
+      t.references :code, :platform
       t.text :body
       t.boolean :works_for_me
-      t.string :platform
+      t.string :name, :url
       t.timestamps
     end
+    
+    add_index :comments, :code_id
   end
 
   def self.down</diff>
      <filename>db/migrate/20090131234059_create_comments.rb</filename>
    </modified>
    <modified>
      <diff>@@ -9,7 +9,7 @@
 #
 # It's strongly recommended to check this file into your version control system.
 
-ActiveRecord::Schema.define(:version =&gt; 20090202123742) do
+ActiveRecord::Schema.define(:version =&gt; 20090202155040) do
 
   create_table &quot;authors&quot;, :force =&gt; true do |t|
     t.string   &quot;name&quot;
@@ -17,6 +17,8 @@ ActiveRecord::Schema.define(:version =&gt; 20090202123742) do
     t.datetime &quot;updated_at&quot;
   end
 
+  add_index &quot;authors&quot;, [&quot;name&quot;], :name =&gt; &quot;index_authors_on_name&quot;
+
   create_table &quot;authorships&quot;, :force =&gt; true do |t|
     t.integer  &quot;author_id&quot;
     t.integer  &quot;code_id&quot;
@@ -24,6 +26,9 @@ ActiveRecord::Schema.define(:version =&gt; 20090202123742) do
     t.datetime &quot;updated_at&quot;
   end
 
+  add_index &quot;authorships&quot;, [&quot;author_id&quot;], :name =&gt; &quot;index_authorships_on_author_id&quot;
+  add_index &quot;authorships&quot;, [&quot;code_id&quot;], :name =&gt; &quot;index_authorships_on_code_id&quot;
+
   create_table &quot;codes&quot;, :force =&gt; true do |t|
     t.string   &quot;name&quot;
     t.string   &quot;description&quot;
@@ -31,36 +36,35 @@ ActiveRecord::Schema.define(:version =&gt; 20090202123742) do
     t.string   &quot;rubyforge&quot;
     t.string   &quot;github&quot;
     t.string   &quot;code_type&quot;
+    t.string   &quot;slug_name&quot;
     t.decimal  &quot;latest_version&quot;
     t.datetime &quot;created_at&quot;
     t.datetime &quot;updated_at&quot;
-    t.string   &quot;slug_name&quot;
   end
 
+  add_index &quot;codes&quot;, [&quot;name&quot;], :name =&gt; &quot;index_codes_on_name&quot;
+  add_index &quot;codes&quot;, [&quot;updated_at&quot;], :name =&gt; &quot;index_codes_on_updated_at&quot;
+
   create_table &quot;comments&quot;, :force =&gt; true do |t|
     t.integer  &quot;code_id&quot;
-    t.integer  &quot;user_id&quot;
+    t.integer  &quot;platform_id&quot;
     t.text     &quot;body&quot;
     t.boolean  &quot;works_for_me&quot;
-    t.string   &quot;platform&quot;
+    t.string   &quot;name&quot;
+    t.string   &quot;url&quot;
     t.datetime &quot;created_at&quot;
     t.datetime &quot;updated_at&quot;
   end
 
-  create_table &quot;users&quot;, :force =&gt; true do |t|
+  add_index &quot;comments&quot;, [&quot;code_id&quot;], :name =&gt; &quot;index_comments_on_code_id&quot;
+  add_index &quot;comments&quot;, [&quot;created_at&quot;], :name =&gt; &quot;index_comments_on_created_at&quot;
+
+  create_table &quot;platforms&quot;, :force =&gt; true do |t|
     t.string   &quot;name&quot;
-    t.string   &quot;email&quot;
-    t.string   &quot;homepage&quot;
-    t.string   &quot;login&quot;,                              :null =&gt; false
-    t.string   &quot;crypted_password&quot;,                   :null =&gt; false
-    t.string   &quot;password_salt&quot;,                      :null =&gt; false
-    t.string   &quot;persistence_token&quot;,                  :null =&gt; false
-    t.string   &quot;single_access_token&quot;,                :null =&gt; false
-    t.string   &quot;perishable_token&quot;,                   :null =&gt; false
-    t.integer  &quot;login_count&quot;,         :default =&gt; 0, :null =&gt; false
     t.datetime &quot;created_at&quot;
     t.datetime &quot;updated_at&quot;
-    t.boolean  &quot;is_admin&quot;
   end
 
+  add_index &quot;platforms&quot;, [&quot;name&quot;], :name =&gt; &quot;index_platforms_on_name&quot;
+
 end</diff>
      <filename>db/schema.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,4 +3,8 @@ namespace :isitruby19 do
   task :import =&gt; :environment do
     GemImporter.import
   end
+  
+  task :load_platforms =&gt; :environment do
+    Platform.load_defaults
+  end 
 end
\ No newline at end of file</diff>
      <filename>lib/tasks/isitruby19.rake</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>db/migrate/20090131234446_create_users.rb</filename>
    </removed>
    <removed>
      <filename>db/migrate/20090201000927_add_slug_to_codes.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>05710fe4e78a739a2ab85db9f69d913df0279c6a</id>
    </parent>
  </parents>
  <author>
    <name>Rahoul Baruah</name>
    <email>rahoul@brightbox.co.uk</email>
  </author>
  <url>http://github.com/brightbox/isitruby19/commit/d1d730a655ca6d7eeb2c1bea9628d4efaba2dc42</url>
  <id>d1d730a655ca6d7eeb2c1bea9628d4efaba2dc42</id>
  <committed-date>2009-02-02T07:54:16-08:00</committed-date>
  <authored-date>2009-02-02T07:54:16-08:00</authored-date>
  <message>basic commenting in place</message>
  <tree>8e4085faaff0b64994c899fc259289d6b3eacb7b</tree>
  <committer>
    <name>Rahoul Baruah</name>
    <email>rahoul@brightbox.co.uk</email>
  </committer>
</commit>
