Class: Kms::SnippetsController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#set_csrf_cookie_for_ng

Instance Method Details

#createObject



9
10
11
12
# File 'app/controllers/kms/snippets_controller.rb', line 9

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

#destroyObject



25
26
27
28
29
# File 'app/controllers/kms/snippets_controller.rb', line 25

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

#indexObject



5
6
7
# File 'app/controllers/kms/snippets_controller.rb', line 5

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

#showObject



20
21
22
23
# File 'app/controllers/kms/snippets_controller.rb', line 20

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

#updateObject



14
15
16
17
18
# File 'app/controllers/kms/snippets_controller.rb', line 14

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