Class: TagsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/tags_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject

Raises:

  • (ActiveRecord::RecordNotFound)

2
3
4
5
6
7
8
# File 'app/controllers/tags_controller.rb', line 2

def show
  @tag = Tag.find_by(slug: params[:tag].strip.downcase)
  raise ActiveRecord::RecordNotFound if @tag.blank?

  @posts = @tag.posts.order('created_at DESC').limit(12)
  @posts = @posts.older_than(Time.at(params[:before].to_f)) if params[:before].present?
end