Sha256: b270d4dbfa87fccce6b0be12e9618d5d9bd0e5d437dbcebe396ddcc860e3b173

Contents?: true

Size: 644 Bytes

Versions: 1

Compression:

Stored size: 644 Bytes

Contents

module HyperKittenMeow
  module Concerns
    module Controllers
      module TagsController
        extend ActiveSupport::Concern

        def show
          @tag = Categorical::Tag.find_by_slug!(params[:id])
          @pagy, @taggables = pagy(@tag.
            send(fetch_taggable_type).
            published.
            sorted_by_published_date)
        end

        private

        def fetch_taggable_type
          if params[:type]
            taggable_type = params[:type]
            return taggable_type.underscore.to_sym
          else
            return "HyperKittenMeow::Post"
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hyper-kitten-meow-0.1.2 lib/hyper_kitten_meow/concerns/controllers/tags_controller.rb