Sha256: 4f898ecb8674cd502b881e119cfb6fdbfc934f221bef94268cd88d4e36398964

Contents?: true

Size: 891 Bytes

Versions: 2

Compression:

Stored size: 891 Bytes

Contents

module Elabs
  class TagsController < ElabsApplicationController
    ALLOWED_ORDER_FROM = %w[name].freeze
    DEFAULT_ORDER      = { name: :desc }.freeze

    before_action :set_tag, only: %i[show]

    # GET /tags
    # GET /tags.json
    def index
      @tags = Tag.all
    end

    # GET /tags/1
    # GET /tags/1.json
    def show
      @tag_albums = @tag.albums.for_relation
      @tag_articles = @tag.articles.for_relation
      @tag_notes = @tag.notes.for_relation
      @tag_projects = @tag.projects.for_relation
      @tag_uploads = @tag.uploads.for_relation
    end

    private

    # Use callbacks to share common setup or constraints between actions.
    def set_tag
      @tag = Tag.find(params[:id])
    end

    # Never trust parameters from the scary internet, only allow the white list through.
    def tag_params
      params.require(:tag).permit(:name)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
elabs-2.0.0 app/controllers/elabs/tags_controller.rb
elabs-2.0.0.pre app/controllers/elabs/tags_controller.rb