Sha256: fe5731c97497e044a87f42e21c6b844f8ac7df6afcd25381263fab5e140d38a9

Contents?: true

Size: 690 Bytes

Versions: 2

Compression:

Stored size: 690 Bytes

Contents

module RailsBlogEngine
  class ApplicationController < ActionController::Base
    # Use our parent application's layout, so that we "auto-blend" into
    # the existing look-and-feel of the site.
    layout 'application'

    helper_method :post_permalink_url
    helper_method :post_permalink_path

    protected

    def post_permalink_local_path(post)
      date = post.published_at.utc
      sprintf('%04d/%02d/%02d/%s', date.year, date.month,
              date.day, post.permalink)
    end

    def post_permalink_path(post)
      root_path + post_permalink_local_path(post)
    end

    def post_permalink_url(post)
      root_url + post_permalink_local_path(post)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails_blog_engine-0.0.2 app/controllers/rails_blog_engine/application_controller.rb
rails_blog_engine-0.0.1 app/controllers/rails_blog_engine/application_controller.rb