Sha256: 546ade23983f38262e392b52c50388f28649d2a1ea55ef8e52f5d7c1b808829a

Contents?: true

Size: 853 Bytes

Versions: 1

Compression:

Stored size: 853 Bytes

Contents

module RailsBlogEngine
  class ApplicationController < ActionController::Base
    layout :choose_layout

    helper_method :post_permalink_url
    helper_method :post_permalink_path

    protected

    # We normally use one of our parent application's layouts, so that we
    # "auto-blend" into the existing look-and-feel of the site.  The
    # specific layout is specified by our initializer.
    def choose_layout
      Rails.configuration.rails_blog_engine.layout
    end

    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)
      blog_path + post_permalink_local_path(post)
    end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_blog_engine-0.0.3 app/controllers/rails_blog_engine/application_controller.rb