remove unused controller actions
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
class PostsController < ApplicationController
|
||||
before_action :set_post, only: %i[ show update destroy ]
|
||||
|
||||
# GET /posts
|
||||
# GET /posts.json
|
||||
def index
|
||||
@@ -10,6 +8,7 @@ class PostsController < ApplicationController
|
||||
# GET /posts/1
|
||||
# GET /posts/1.json
|
||||
def show
|
||||
@post = Post.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /posts
|
||||
@@ -24,30 +23,10 @@ class PostsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /posts/1
|
||||
# PATCH/PUT /posts/1.json
|
||||
def update
|
||||
if @post.update(post_params)
|
||||
render :show, status: :ok, location: @post
|
||||
else
|
||||
render json: @post.errors, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /posts/1
|
||||
# DELETE /posts/1.json
|
||||
def destroy
|
||||
@post.destroy
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_post
|
||||
@post = Post.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def post_params
|
||||
params.require(:post).permit(:content, :user_id, :quoted_post_id)
|
||||
end
|
||||
# Only allow a list of trusted parameters through.
|
||||
def post_params
|
||||
params.require(:post).permit(:content, :user_id, :quoted_post_id)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user