<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -14,7 +14,7 @@ class BlogetMigration &lt; ActiveRecord::Migration
       t.string :poster_type, :null =&gt; false
       t.string :title, :null =&gt; false
       t.text :content, :null =&gt; false
-      t.string :state, :null =&gt; false, :default =&gt; 'draft'
+      t.boolean :published, :null =&gt; false, :default =&gt; false
       t.timestamps 
     end
 </diff>
      <filename>generators/bloget/templates/migrate/bloget_migration.rb</filename>
    </modified>
    <modified>
      <diff>@@ -37,7 +37,7 @@ class CommentsControllerTest &lt; ActionController::TestCase
     a_post = create_post
     
     post :create, :post_id =&gt; a_post.permalink, :comment =&gt; { :content =&gt; 'My comment' }
-    assert_redirected_to :controller =&gt; 'posts', :action =&gt; 'show'
+    assert_match /#{a_post.permalink}#comment_\d+$/, redirect_to_url
     assert_match &quot;success&quot;, flash[:notice]
   end
 </diff>
      <filename>generators/bloget/templates/test/functional/comments_controller_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -75,23 +75,9 @@ class PostsControllerTest &lt; ActionController::TestCase
       :permalink =&gt; get_permalink,
       :content =&gt; 'Some content'
     }
-    assert_redirected_to :action =&gt; 'show'
-    assert_match &quot;success&quot;, flash[:notice]
-  end
 
-  def test_post_should_be_published_when_published_passed_in_params
-    blogger = create_blogger
-    @controller.stubs(:logged_in?).returns(true)
-    @controller.stubs(:current_user).returns(blogger.poster)
-
-    p = create_post
-    Post.stubs(:new).returns(p)
-    p.stubs(:save).returns(true)
-    p.expects(:publish!)
-    
-    post :create, :post =&gt; {
-      :state =&gt; 'published'
-    }   
+    assert_match /\/posts\/[a-z\d\-_]+$/, redirect_to_url
+    assert_match &quot;success&quot;, flash[:notice]
   end
   
   def test_must_be_logged_in_to_get_edit_form
@@ -169,7 +155,7 @@ class PostsControllerTest &lt; ActionController::TestCase
   end
   
   def test_should_not_show_draft_posts_in_index
-    post = create_post(:state =&gt; 'draft', :title =&gt; String.random)
+    post = create_post(:published =&gt; false, :title =&gt; String.random)
     get :index
 
     assert_select &quot;h2 a&quot;, :text =&gt; post.display_title, :count =&gt; 0
@@ -180,7 +166,7 @@ class PostsControllerTest &lt; ActionController::TestCase
     @controller.stubs(:logged_in?).returns(true)
     @controller.stubs(:current_user).returns(blogger.poster)
 
-    post = create_post(:state =&gt; 'draft', :title =&gt; String.random)
+    post = create_post(:published =&gt; false, :title =&gt; String.random)
     get :index
 
     assert_select &quot;h2 a&quot;, post.display_title
@@ -188,7 +174,7 @@ class PostsControllerTest &lt; ActionController::TestCase
   end
   
   def test_should_not_show_individual_post_in_draft_state
-    post = create_post(:state =&gt; 'draft')
+    post = create_post(:published =&gt; false)
     get :show, :id =&gt; post.permalink
     assert_response 401
   end
@@ -198,7 +184,7 @@ class PostsControllerTest &lt; ActionController::TestCase
     @controller.stubs(:logged_in?).returns(true)
     @controller.stubs(:current_user).returns(blogger.poster)
 
-    post = create_post(:state =&gt; 'draft')
+    post = create_post(:published =&gt; false)
     get :show, :id =&gt; post.permalink
     assert_response :success
   end</diff>
      <filename>generators/bloget/templates/test/functional/posts_controller_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -46,13 +46,7 @@ class PostTest &lt; ActiveSupport::TestCase
     assert !p2.valid?
     assert_not_nil p2.errors[:permalink]
   end
-  
-  def test_can_have_a_state
-    p = create_post
-
-    assert p.respond_to?(:state)
-  end
-  
+    
   def test_should_have_default_state_of_draft 
     p = Post.new(:poster_id =&gt; 1,
                  :poster_type =&gt; 'User',
@@ -72,12 +66,5 @@ class PostTest &lt; ActiveSupport::TestCase
     p.publish!
     assert p.published?
   end
-  
-  def test_should_not_have_other_states
-    p = create_post
-    p.state = 'ready'
-
-    assert !p.valid?
-  end
-  
+    
 end</diff>
      <filename>generators/bloget/templates/test/unit/posts_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,4 @@
-&lt;%= render :partial =&gt; &quot;comment&quot; %&gt;
+&lt;%= render :partial =&gt; &quot;comment&quot;, :object =&gt; @comment %&gt;
 
 &lt;p&gt;&lt;%= link_to &quot;&lt;&lt; Back to post&quot;, post_url(@comment.post) %&gt;&lt;/p&gt;
 </diff>
      <filename>generators/bloget/templates/views/comments/show.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -9,10 +9,8 @@
 &lt;/div&gt;
 
 &lt;div class=&quot;field&quot;&gt;
-  &lt;label for=&quot;post_state&quot;&gt;State:&lt;/label&gt;&lt;br /&gt;
-  &lt;% Post.states.each do |state| %&gt;
-    &lt;%= form.radio_button :state, state %&gt; &lt;%= state.to_s.capitalize %&gt;&lt;br /&gt;
-  &lt;% end %&gt;
+  &lt;label for=&quot;post_published&quot;&gt;Published?&lt;/label&gt;
+  &lt;%= form.check_box :published %&gt;
 &lt;/div&gt;
 
 &lt;div class=&quot;field&quot;&gt;</diff>
      <filename>generators/bloget/templates/views/posts/_form.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -23,36 +23,30 @@ module Bloget
         @blog ||= Blog.instance
                 
         @rss = formatted_posts_url(:format =&gt; 'atom')
-    
-        conditions = Hash.new
-        unless logged_in? and Blogger.valid_blogger?(current_user)
-          conditions[:state] = 'published'
-        end
-
-        find_args = {:order =&gt; 'created_at DESC'}
-        unless conditions.empty?
-          find_args[:conditions] = conditions
-        end
+        
+        posts = if logged_in? and Blogger.valid_blogger?(current_user)
+                  Post.chronologically
+                else
+                  Post.published.chronologically
+                end
         
         respond_to do |format|
-          
           format.html do
-            if Post.respond_to?(:paginate)
-              @posts = Post.paginate(:all, find_args.merge(:page =&gt; params[:page]))
+            if posts.respond_to?(:paginate)
+              @posts = posts.paginate(:all, :page =&gt; params[:page])
             else
-              @posts = Post.find(:all, find_args)
+              @posts = posts.find(:all)
             end  
           end
           
           format.atom do 
-            if Post.respond_to?(:paginate)
-              @posts = Post.paginate(:all, find_args.merge(:page =&gt; params[:page]))
+            if posts.respond_to?(:paginate)
+              @posts = posts.paginate(:all, :page =&gt; params[:page])
             else
-              @posts = Post.find(:all, find_args.merge(:limit =&gt; 20))
+              @posts = posts.find(:all)
             end
             render :layout =&gt; false
           end
-          
         end
       end
       
@@ -69,7 +63,6 @@ module Bloget
         @post.poster = current_user
     
         if @post.save
-          @post.publish! if params[:post][:state] == 'published'
           flash[:notice] = &quot;The post was successfully saved.&quot;
           redirect_to post_url(@post)
         else</diff>
      <filename>lib/bloget/controllers/posts_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -14,25 +14,11 @@ module Bloget
           validates_presence_of :permalink
           validates_uniqueness_of :permalink
           validates_format_of :permalink, :with =&gt; /^[\w\-]+$/,
-            :message =&gt; 'must only be made up of numbers, letters, and dashes'          
-
-          acts_as_state_machine :initial =&gt; :draft
-
-          state :draft
-          state :published, :enter =&gt; lambda { |o| o.save if o.new_record? }
-
-          validates_inclusion_of :state, :in =&gt; states.map { |s| s.to_s }
-
-          event :publish do
-            transitions :from =&gt; :draft, :to =&gt; :published, :guard =&gt; lambda { 
-              |o| o.valid?
-            }
-          end
-
-          event :unpublish do
-            transitions :from =&gt; :published, :to =&gt; :draft
-          end
+          :message =&gt; 'must only be made up of numbers, letters, and dashes'
 
+          named_scope :published, { :conditions =&gt; ['published = ?', true] }
+          named_scope :draft, { :conditions =&gt; ['published = ?', false] }
+          named_scope :chronologically, { :order =&gt; 'created_at DESC' }
         end        
       end
       
@@ -42,10 +28,30 @@ module Bloget
       
       def display_title
         title = read_attribute(:title)
-        title += &quot; [DRAFT]&quot; if !title.empty? and state == 'draft'
+        title += &quot; [DRAFT]&quot; if !title.empty? and draft?
         title
       end
-            
+
+      def publish
+        update_attribute(:published, true)
+      end
+
+      alias :publish! :publish
+
+      def unpublish
+        update_attribute(:published, false)
+      end
+
+      alias :unpublish! :unpublish
+
+      def draft?
+        !published?
+      end
+
+      def state
+        published? ? 'published' : 'draft'
+      end
+      
     end
   end
 end</diff>
      <filename>lib/bloget/models/post.rb</filename>
    </modified>
    <modified>
      <diff>@@ -21,15 +21,13 @@ namespace :bloget do
   desc &quot;Installs required and recommended plugins for Bloget.&quot;
   task :install_friends do
     Dir.chdir(RAILS_ROOT) do
-      puts `ruby script/plugin install http://svn.techno-weenie.net/projects/plugins/restful_authentication/`
-      puts `ruby script/plugin install svn://errtheblog.com/svn/plugins/will_paginate`
-      puts `ruby script/plugin install http://elitists.textdriven.com/svn/plugins/acts_as_state_machine/trunk/`
+      puts `ruby script/plugin install git://github.com/technoweenie/restful-authentication.git`
+      puts `ruby script/plugin install git://github.com/mislav/will_paginate.git`
     end
   end
   
   desc &quot;Sets up a Rails app with the recommended infrastructure for Bloget.&quot;
   task :setup_app =&gt; [:load_rails, :install_friends] do
-#    puts `ruby script/generate authenticated user sessions --force`
     Rails::Generator::Scripts::Generate.new.run(['authenticated', 'user', 'sessions'])    
     Rails::Generator::Scripts::Generate.new.run(['bloget_app'])
   end</diff>
      <filename>tasks/bloget_tasks.rake</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>839ea2b03a484202f3692444673cb9168353e4e9</id>
    </parent>
  </parents>
  <author>
    <name>Clinton R. Nixon</name>
    <email>crnixon@gmail.com</email>
  </author>
  <url>http://github.com/vigetlabs/bloget/commit/6f695692cd7b98a1ee3261dff1e35dab31ae4ce7</url>
  <id>6f695692cd7b98a1ee3261dff1e35dab31ae4ce7</id>
  <committed-date>2009-01-23T13:58:52-08:00</committed-date>
  <authored-date>2009-01-23T13:58:52-08:00</authored-date>
  <message>Removed aasm; fixed tests</message>
  <tree>b4b355f4cc7ad2614654407016a88fb0f3d21368</tree>
  <committer>
    <name>Clinton R. Nixon</name>
    <email>crnixon@gmail.com</email>
  </committer>
</commit>
