Sha256: 92ff61b0942450d535884980a506732687bb4451a083895e78d6d770bf27334a

Contents?: true

Size: 728 Bytes

Versions: 3

Compression:

Stored size: 728 Bytes

Contents

module Dune::Api
  module V1
    class TagsController < BaseController
      before_action :require_admin!, except: %i(index show)

      include PaginatedController

      has_scope :popular, type: :boolean

      def index
        respond_with_pagination apply_scopes(Tag).all
      end

      def create
        respond_with Tag.create(permited_params)
      end

      def update
        respond_with Tag.update(params[:id], permited_params)
      end

      def show
        respond_with Tag.find(params[:id])
      end

      def destroy
        respond_with Tag.destroy(params[:id])
      end

      private

      def permited_params
        params.permit({ tag: [ :name, :visible ] })[:tag]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dune-api-1.1.0 app/controllers/dune/api/v1/tags_controller.rb
dune-api-1.0.2 app/controllers/dune/api/v1/tags_controller.rb
dune-api-1.0.1 app/controllers/dune/api/v1/tags_controller.rb