#7 ぼちぼち
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
class TagsController < ApplicationController
|
||||
before_action :set_tags, only: %i[ show update destroy ]
|
||||
|
||||
def index
|
||||
@tags = Tag.all
|
||||
render json: @tags
|
||||
end
|
||||
|
||||
def show
|
||||
render json: @tag
|
||||
end
|
||||
|
||||
def create
|
||||
@@ -13,4 +18,15 @@ class TagsController < ApplicationController
|
||||
|
||||
def destroy
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_tag
|
||||
@tag = Tag.find(params.expect(:id))
|
||||
end
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def tag_params
|
||||
params.expect(tag: [ :title, :body ])
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user