Sha256: 837f22601d6739723d2532c3eabb9ba0eca6f5871975bea199f1c6ad27e32a2b

Contents?: true

Size: 662 Bytes

Versions: 2

Compression:

Stored size: 662 Bytes

Contents

class BlogController < ApplicationController

  def index
    @posts = Page.for_blog.published.order('published_at desc').paginate(:page => params[:page], :per_page => 20)
    respond_to do |format|
      format.html { render :layout => 'blog' }
      format.atom
    end
  end

  def by_tag
    # this little hack is necessary because globalize won't let me access the tag directly by name
    tag_id = Tag::Translation.find_by( locale: I18n.locale.to_s, name: params[:id] ).tag_id
    @tag = Tag.find(tag_id)
    @posts = @tag.pages.published.order('published_at desc').paginate(:page => params[:page], :per_page => 20)
    render :layout => 'blog'
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tkh_content-0.10.6 app/controllers/blog_controller.rb
tkh_content-0.10.5.1 app/controllers/blog_controller.rb