Sha256: 5d9cb6276fd9395f3e9700877c96de9b926357ba9d7f3f4d9323580482ed43d5

Contents?: true

Size: 730 Bytes

Versions: 4

Compression:

Stored size: 730 Bytes

Contents

module Kms
  class SnippetsController < ApplicationController
    respond_to :json

    def index
      render json: Snippet.all, root: false
    end

    def create
      @snippet = Snippet.create(snippet_params)
      render json: @snippet, root: false
    end

    def update
      @snippet = Snippet.find(params[:id])
      @snippet.update(snippet_params)
      render json: @snippet, root: false
    end

    def show
      @snippet = Snippet.find(params[:id])
      render json: @snippet, root: false
    end

    def destroy
      @snippet = Snippet.find(params[:id])
      @snippet.destroy
      render json: @snippet
    end

    protected

    def snippet_params
      params.require(:snippet).permit!
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kms-0.5.0 app/controllers/kms/snippets_controller.rb
kms-0.4.2 app/controllers/kms/snippets_controller.rb
kms-0.4.1 app/controllers/kms/snippets_controller.rb
kms-0.4.0 app/controllers/kms/snippets_controller.rb