<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,10 @@
 module Merb
   module GlobalHelpers
     # helpers defined here available to all views.  
+    def print_date( date )
+      months = %w(x Jan Feb Mar Apr May Jun Jul Aug Sept Oct Nov Dec)
+      '&lt;div class=&quot;date&quot;&gt;&lt;span class=&quot;month&quot;&gt;%s&lt;/span&gt;&lt;span class=&quot;day&quot;&gt;%.2d&lt;/span&gt;&lt;/div&gt;' %
+        [ months[date.month], date.day ]
+    end
   end
 end</diff>
      <filename>app/helpers/global_helpers.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,189 +6,189 @@ class Blog
 #  include DataMapper::Reflection
 
   property :id,           Serial
-#  property :title,        String
-#  property :path_title,   String
-#  property :body,         Text
-#  property :body_html,    Text,    :lazy =&gt; false, :writer =&gt; :private
-#  property :created_at,   DateTime
-#  property :updated_at,   DateTime
-#  property :published_at, DateTime
-#  property :year,         Integer
-#  property :month,        Integer
-#  property :permalink,    Text
-#  property :comments_expire_at, DateTime #, :reflect =&gt; :parse_date
-
-#  belongs_to :user
-#  belongs_to :category
-#  has n, :comments
-#
-#  #validates_present :title
-#
-#  before :create, :set_path_title
-#  before :create, :set_year
-#  before :create, :set_month
-#  before :save,   :normalize_category_id
-#
-#  # The before_save filter doesn't seem to work for update
-#  before :create, :cache_body_html
-#  before :update, :cache_body_html
-#
-#  class &lt;&lt; self
-#    def last( opts ) get( default_options.merge(opts).merge( :conditions =&gt; ['published_at IS NOT NULL'] ) ); end
-#
-#    # Find all published blogs
-#    def published( options = {} )
-#      all( default_options.merge( :conditions =&gt; ['blogs.published_at IS NOT NULL'] ).merge( options ) )
-#    end
-#
-#    def per_page() 10; end
-#
-#    # Gets the blogs to popluate the RSS feed with
-#    def get_rss
-#      all( :conditions =&gt; ['published_at IS NOT NULL'], :order =&gt; 'published_at DESC', :limit =&gt; per_page )
-#    end
-#
-#    # Returns a paginator object for paginating blogs.
-#    #
-#    # ==== Parameters
-#    # options&lt;Hash&gt;:: options used to qualify the pagination and blog selection
-#    #
-#    # ==== Options
-#    # :all =&gt; if it evaluates to TRUE, then both published and unpublished blogs
-#    #         will be paginated.  The default is for only published blogs to display
-#    # :per_page =&gt; Override the default setting for the number of blogs per page
-#    # _anything_else_ =&gt; will be fed as a parameter to Blog#all
-#    #
-#    # ==== Example
-#    #  @page = Blog.paginate_for( current_user ).page( params[:page] )
-#    def paginate( options = {} )
-#      pp  = options.delete(:per_page) || per_page
-#      all = options.delete(:all)
-#
-#      options.delete(:category_id) if options[:category_id].nil?
-#
-#      count = count_for( all, options[:category_id] )
-#
-#      Paginator.new( count, per_page ) do |offset, per_page|
-#        all( default_options.merge(options).merge( :limit =&gt; pp, :offset =&gt; offset ) )
-#      end
-#    end
-#
-#    private
-#      def default_options() { :order =&gt; [:published_at.desc] }; end
-#
-#      def count_for( all, category_id = nil )
-#        conditions = category_id ? ['category_id = ?'] : [true]
-#        parameters = category_id ? [ category_id ]     : []
-#
-#        unless all
-#          conditions &lt;&lt; 'published_at IS NOT NULL'
-#        end
-#
-#        conditions = [ conditions.join(' AND '), *parameters ].compact
-#        Blog.count( :conditions =&gt; conditions )
-#      end
-#  end
-#
-#  # Returns a boolean indicating whether or not comments can be added to the blog
-#  def comments_closed?
-#    return false if self.comments_expire_at.nil?
-#    Date.today &gt;= self.comments_expire_at.to_date
-#  end
-#
-#  def comments_expire_at=( date )
-#    @comments_expire_at = parse_date( date )
-#  end
-#
-#  alias published published_at
-#
-#  def published=( value )
-#    if [0,'0',false,''].include?(value)
-#      self.published_at &amp;&amp;= nil
-#    else
-#      self.published_at ||= Time.now
-#    end
-#  end
-#
-#  def published?
-#    !published_at.nil?
-#  end
-#
-#  def preview( words = 35, paragraphs = 2 )
-#    words = body_without_markup.split(/ +/)[0...words].join(' ')
-#    paras = words.split(/[\n\r]+/)
-#    '&lt;p&gt;%s...&lt;/p&gt;' % paras[0...paragraphs].join('&lt;/p&gt;&lt;p&gt;')
-#  end
-#
-#  def count_comments
-#    Comment.count( :conditions =&gt; ['comments.blog_id = ?', self.id] )
-#  end
-#
-#  def body()      @body      || ''; end
-#  def body_html() @body_html || ''; end
-#
-#  private
-#
-#    def set_path_title
-#      self.path_title ||= self.title.downcase.gsub(/[^a-zA-Z_0-9 ]+/, '').gsub(/ +/, '-')
-#    end
-#
-#    def set_year()  self.year  = Time.now.year;  end
-#    def set_month() self.month = Time.now.month; end
-#
-#    # Before saving, check to make sure that the category_id is set to an integer.
-#    # If not, create a new category with the title of teh category_id.
-#    def normalize_category_id
-#      return true if [nil,0].include?(self.category_id)
-#      if self.category_id.to_s =~ /[a-zA-Z]/
-#        category = Category.find_or_create( :title =&gt; self.category_id )
-#        self.category_id = category.id
-#      end
-#    end
-#
-#    def cache_body_html
-#      return true if self.body.blank?
-#      self.body_html = formatted_body
-#    end
-#
-#    def parse_date( date_params )
-#      return date_params unless date_params.is_a?( Hash )
-#      d = date_params
-#      Date.parse('%4d.%2d.%2d' % [d['year'],d['month'],d['day']])
-#    end
-#
-#    def body_without_markup
-#      body_html.to_s.gsub(%r{&lt;[^&gt;]*&gt;},'')
-#    end
-#
-#    # From http://www.ruby-forum.com/topic/77231
-#    REGEX = /\[code.*?code\]/m
-#    Syntaxi::line_number_method = 'floating'
-#    Syntaxi::wrap_enabled = false
-#
-#    # formattes the body using redcloth, colorizes ruby code using syntax(i)
-#    def formatted_body
-#      code_blocks = _get_code_blocks(self.body)
-#      red_clothed = RedCloth.new(body.gsub(REGEX, '${code_block}')).to_html
-#
-#      code_blocks.each { |c|
-#        c = Syntaxi.new(c).process
-#        red_clothed.sub!(/\$\{code_block\}/, c)
-#      }
-#
-#      red_clothed
-#    end
-#
-#    # retrieves code in [code][/code] blocks
-#    def _get_code_blocks(contents)
-#      code_blocks = []
-#      code_block = contents.slice(REGEX)
-#      if (!code_block.nil?)
-#        code_blocks &lt;&lt; code_block
-#        while code_block = $'.slice(REGEX)
-#          code_blocks &lt;&lt; code_block
-#        end
-#      end
-#      code_blocks
-#    end
+  property :title,        String
+  property :path_title,   String
+  property :body,         Text
+  property :body_html,    Text,    :lazy =&gt; false, :writer =&gt; :private
+  property :created_at,   DateTime
+  property :updated_at,   DateTime
+  property :published_at, DateTime
+  property :year,         Integer
+  property :month,        Integer
+  property :permalink,    Text
+  property :comments_expire_at, DateTime #, :reflect =&gt; :parse_date
+
+  belongs_to :user
+  belongs_to :category
+  has n, :comments
+
+  #validates_present :title
+
+  before :create, :set_path_title
+  before :create, :set_year
+  before :create, :set_month
+  before :save,   :normalize_category_id
+
+  # The before_save filter doesn't seem to work for update
+  before :create, :cache_body_html
+  before :update, :cache_body_html
+
+  class &lt;&lt; self
+    def last( opts ) first( default_options.merge(opts).merge( :conditions =&gt; ['published_at IS NOT NULL'] ) ); end
+
+    # Find all published blogs
+    def published( options = {} )
+      all( default_options.merge( :conditions =&gt; ['blogs.published_at IS NOT NULL'] ).merge( options ) )
+    end
+
+    def per_page() 10; end
+
+    # Gets the blogs to popluate the RSS feed with
+    def get_rss
+      all( :conditions =&gt; ['published_at IS NOT NULL'], :order =&gt; 'published_at DESC', :limit =&gt; per_page )
+    end
+
+    # Returns a paginator object for paginating blogs.
+    #
+    # ==== Parameters
+    # options&lt;Hash&gt;:: options used to qualify the pagination and blog selection
+    #
+    # ==== Options
+    # :all =&gt; if it evaluates to TRUE, then both published and unpublished blogs
+    #         will be paginated.  The default is for only published blogs to display
+    # :per_page =&gt; Override the default setting for the number of blogs per page
+    # _anything_else_ =&gt; will be fed as a parameter to Blog#all
+    #
+    # ==== Example
+    #  @page = Blog.paginate_for( current_user ).page( params[:page] )
+    def paginate( options = {} )
+      pp  = options.delete(:per_page) || per_page
+      all = options.delete(:all)
+
+      options.delete(:category_id) if options[:category_id].nil?
+
+      count = count_for( all, options[:category_id] )
+
+      Paginator.new( count, per_page ) do |offset, per_page|
+        all( default_options.merge(options).merge( :limit =&gt; pp, :offset =&gt; offset ) )
+      end
+    end
+
+    private
+      def default_options() { :order =&gt; [:published_at.desc] }; end
+
+      def count_for( all, category_id = nil )
+        conditions = category_id ? ['category_id = ?'] : [true]
+        parameters = category_id ? [ category_id ]     : []
+
+        unless all
+          conditions &lt;&lt; 'published_at IS NOT NULL'
+        end
+
+        conditions = [ conditions.join(' AND '), *parameters ].compact
+        Blog.count( :conditions =&gt; conditions )
+      end
+  end
+
+  # Returns a boolean indicating whether or not comments can be added to the blog
+  def comments_closed?
+    return false if self.comments_expire_at.nil?
+    Date.today &gt;= self.comments_expire_at.to_date
+  end
+
+  def comments_expire_at=( date )
+    @comments_expire_at = parse_date( date )
+  end
+
+  alias published published_at
+
+  def published=( value )
+    if [0,'0',false,''].include?(value)
+      self.published_at &amp;&amp;= nil
+    else
+      self.published_at ||= Time.now
+    end
+  end
+
+  def published?
+    !published_at.nil?
+  end
+
+  def preview( words = 35, paragraphs = 2 )
+    words = body_without_markup.split(/ +/)[0...words].join(' ')
+    paras = words.split(/[\n\r]+/)
+    '&lt;p&gt;%s...&lt;/p&gt;' % paras[0...paragraphs].join('&lt;/p&gt;&lt;p&gt;')
+  end
+
+  def count_comments
+    Comment.count( :conditions =&gt; ['comments.blog_id = ?', self.id] )
+  end
+
+  def body()      @body      || ''; end
+  def body_html() @body_html || ''; end
+
+  private
+
+    def set_path_title
+      self.path_title ||= self.title.downcase.gsub(/[^a-zA-Z_0-9 ]+/, '').gsub(/ +/, '-')
+    end
+
+    def set_year()  self.year  = Time.now.year;  end
+    def set_month() self.month = Time.now.month; end
+
+    # Before saving, check to make sure that the category_id is set to an integer.
+    # If not, create a new category with the title of teh category_id.
+    def normalize_category_id
+      return true if [nil,0].include?(self.category_id)
+      if self.category_id.to_s =~ /[a-zA-Z]/
+        category = Category.find_or_create( :title =&gt; self.category_id )
+        self.category_id = category.id
+      end
+    end
+
+    def cache_body_html
+      return true if self.body.blank?
+      self.body_html = formatted_body
+    end
+
+    def parse_date( date_params )
+      return date_params unless date_params.is_a?( Hash )
+      d = date_params
+      Date.parse('%4d.%2d.%2d' % [d['year'],d['month'],d['day']])
+    end
+
+    def body_without_markup
+      body_html.to_s.gsub(%r{&lt;[^&gt;]*&gt;},'')
+    end
+
+    # From http://www.ruby-forum.com/topic/77231
+    REGEX = /\[code.*?code\]/m
+    Syntaxi::line_number_method = 'floating'
+    Syntaxi::wrap_enabled = false
+
+    # formattes the body using redcloth, colorizes ruby code using syntax(i)
+    def formatted_body
+      code_blocks = _get_code_blocks(self.body)
+      red_clothed = RedCloth.new(body.gsub(REGEX, '${code_block}')).to_html
+
+      code_blocks.each { |c|
+        c = Syntaxi.new(c).process
+        red_clothed.sub!(/\$\{code_block\}/, c)
+      }
+
+      red_clothed
+    end
+
+    # retrieves code in [code][/code] blocks
+    def _get_code_blocks(contents)
+      code_blocks = []
+      code_block = contents.slice(REGEX)
+      if (!code_block.nil?)
+        code_blocks &lt;&lt; code_block
+        while code_block = $'.slice(REGEX)
+          code_blocks &lt;&lt; code_block
+        end
+      end
+      code_blocks
+    end
 end
\ No newline at end of file</diff>
      <filename>app/models/blog.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,4 +5,4 @@
 
 %li
   = print_date( blog.published_at )
-  %a{:href =&gt; &quot;#{ url(:blog_by_date, blog) }&quot;}= blog.title
\ No newline at end of file
+  %a{:href =&gt; &quot;#{ url(:blog_by_date, blog.year, blog.month, blog.path_title) }&quot;}= blog.title
\ No newline at end of file</diff>
      <filename>app/parts/views/generic_part/_blog.html.haml</filename>
    </modified>
    <modified>
      <diff>@@ -28,4 +28,4 @@
           - confirm = &quot;return confirm('Are you certain you want to delete this blog?');&quot;
           = delete_button( :blog, blog, 'Delete', {:style   =&gt; 'display:inline;'}, {:onclick =&gt; confirm, :style =&gt; 'font-size:.8em' } )
           %br
-          = link( pluralize( blog.count_comments, 'Comment' ), '#' ) unless blog.count_comments == 0
\ No newline at end of file
+          = link( blog.count_comments == 1 ? 'Comment' : 'Comments', '#' ) unless blog.count_comments == 0
\ No newline at end of file</diff>
      <filename>app/views/admin/blogs/index.html.haml</filename>
    </modified>
    <modified>
      <diff>@@ -1,13 +1,11 @@
 ---
 # This is a sample database file for the DataMapper ORM
 :development: &amp;defaults
-  :adapter: sqlite3
-  :database: db/dev.sqlite3
-  #:adapter: postgres
-  #:database: joe_dev
-  #:username: postgres
-  #:password: postgres
-  #:host: localhost
+  :adapter: postgres
+  :database: joe_dev
+  :username: postgres
+  :password: postgres
+  :host: localhost
 
 :test:
   &lt;&lt;: *defaults</diff>
      <filename>config/database.yml</filename>
    </modified>
    <modified>
      <diff>@@ -50,6 +50,8 @@ dependencies &quot;merb-haml&quot;, &quot;merb-cache&quot;, &quot;merb-parts&quot;, &quot;merb-builder&quot;
 # Frozen Gem dependencies
 dependencies &quot;merb_has_flash&quot;, 'paginator'
 
+dependencies &quot;dm-aggregates&quot;
+
 require 'lib/object_ext'
 dependencies 'lib/merb_router_behavior_ext', 'lib/merb_exceptions_ext'
 </diff>
      <filename>config/init.rb</filename>
    </modified>
    <modified>
      <diff>@@ -27,6 +27,11 @@
 
 Merb.logger.info(&quot;Compiling routes...&quot;)
 Merb::Router.prepare do
+  match(&quot;/login&quot;).to(:controller =&gt; &quot;Sessions&quot;, :action =&gt; &quot;create&quot;).name(:login)
+  match(&quot;/logout&quot;).to(:controller =&gt; &quot;Sessions&quot;, :action =&gt; &quot;destroy&quot;).name(:logout)
+  resources :users
+  resources :sessions
+
   # RESTful routes
   resources :blogs do |b|
     b.resources :comments</diff>
      <filename>config/router.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,11 +2,11 @@
 module AuthenticatedSystem
   def self.add_routes
     Merb::BootLoader.after_app_loads do
-      Merb::Router.prepend do |r|
-        r.match(&quot;/login&quot;).to(:controller =&gt; &quot;Sessions&quot;, :action =&gt; &quot;create&quot;).name(:login)
-        r.match(&quot;/logout&quot;).to(:controller =&gt; &quot;Sessions&quot;, :action =&gt; &quot;destroy&quot;).name(:logout)
-        r.resources :users
-        r.resources :sessions
+      Merb::Router.prepend do
+        match(&quot;/login&quot;).to(:controller =&gt; &quot;Sessions&quot;, :action =&gt; &quot;create&quot;).name(:login)
+        match(&quot;/logout&quot;).to(:controller =&gt; &quot;Sessions&quot;, :action =&gt; &quot;destroy&quot;).name(:logout)
+        resources :users
+        resources :sessions
       end
     end
   end</diff>
      <filename>lib/authenticated_system/authenticated_routes.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>2ccf8befdd525087cda1bffb8a0ea66b22969b81</id>
    </parent>
  </parents>
  <author>
    <name>Aaron Wheeler</name>
    <email>oldaaronwheeler@aaron-wheelers-macbook-pro-15.local</email>
  </author>
  <url>http://github.com/fightinjoe/fightinjoe-merb-blog/commit/6409932ab3612f7770c751c2245a386ede1cda57</url>
  <id>6409932ab3612f7770c751c2245a386ede1cda57</id>
  <committed-date>2008-10-09T00:38:52-07:00</committed-date>
  <authored-date>2008-10-09T00:38:52-07:00</authored-date>
  <message>Finished upgrade with minor bug fixes</message>
  <tree>9e5d3519be34ca10a0628752c49682eff76ae37b</tree>
  <committer>
    <name>Aaron Wheeler</name>
    <email>oldaaronwheeler@aaron-wheelers-macbook-pro-15.local</email>
  </committer>
</commit>
