remove unused controller actions
This commit is contained in:
@@ -1,6 +1,4 @@
|
|||||||
class PostsController < ApplicationController
|
class PostsController < ApplicationController
|
||||||
before_action :set_post, only: %i[ show update destroy ]
|
|
||||||
|
|
||||||
# GET /posts
|
# GET /posts
|
||||||
# GET /posts.json
|
# GET /posts.json
|
||||||
def index
|
def index
|
||||||
@@ -10,6 +8,7 @@ class PostsController < ApplicationController
|
|||||||
# GET /posts/1
|
# GET /posts/1
|
||||||
# GET /posts/1.json
|
# GET /posts/1.json
|
||||||
def show
|
def show
|
||||||
|
@post = Post.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
# POST /posts
|
# POST /posts
|
||||||
@@ -24,30 +23,10 @@ class PostsController < ApplicationController
|
|||||||
end
|
end
|
||||||
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
|
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.
|
# Only allow a list of trusted parameters through.
|
||||||
def post_params
|
def post_params
|
||||||
params.require(:post).permit(:content, :user_id, :quoted_post_id)
|
params.require(:post).permit(:content, :user_id, :quoted_post_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,17 +1,4 @@
|
|||||||
class UserFollowsController < ApplicationController
|
class UserFollowsController < ApplicationController
|
||||||
before_action :set_user_follow, only: %i[ show update destroy ]
|
|
||||||
|
|
||||||
# GET /user_follows
|
|
||||||
# GET /user_follows.json
|
|
||||||
def index
|
|
||||||
@user_follows = UserFollow.all
|
|
||||||
end
|
|
||||||
|
|
||||||
# GET /user_follows/1
|
|
||||||
# GET /user_follows/1.json
|
|
||||||
def show
|
|
||||||
end
|
|
||||||
|
|
||||||
# POST /user_follows
|
# POST /user_follows
|
||||||
# POST /user_follows.json
|
# POST /user_follows.json
|
||||||
def create
|
def create
|
||||||
@@ -24,30 +11,16 @@ class UserFollowsController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# PATCH/PUT /user_follows/1
|
|
||||||
# PATCH/PUT /user_follows/1.json
|
|
||||||
def update
|
|
||||||
if @user_follow.update(user_follow_params)
|
|
||||||
render :show, status: :ok, location: @user_follow
|
|
||||||
else
|
|
||||||
render json: @user_follow.errors, status: :unprocessable_entity
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# DELETE /user_follows/1
|
# DELETE /user_follows/1
|
||||||
# DELETE /user_follows/1.json
|
# DELETE /user_follows/1.json
|
||||||
def destroy
|
def destroy
|
||||||
@user_follow.destroy
|
UserFollow.find(params[:id]).destroy
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
|
||||||
def set_user_follow
|
|
||||||
@user_follow = UserFollow.find(params[:id])
|
|
||||||
end
|
|
||||||
|
|
||||||
# Only allow a list of trusted parameters through.
|
# Only allow a list of trusted parameters through.
|
||||||
def user_follow_params
|
def user_follow_params
|
||||||
params.require(:user_follow).permit(:follower_id, :followed_id)
|
params.require(:user_follow).permit(:follower_id, :followed_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,53 +1,7 @@
|
|||||||
class UsersController < ApplicationController
|
class UsersController < ApplicationController
|
||||||
before_action :set_user, only: %i[ show update destroy ]
|
|
||||||
|
|
||||||
# GET /users
|
|
||||||
# GET /users.json
|
|
||||||
def index
|
|
||||||
@users = User.all
|
|
||||||
end
|
|
||||||
|
|
||||||
# GET /users/1
|
# GET /users/1
|
||||||
# GET /users/1.json
|
# GET /users/1.json
|
||||||
def show
|
def show
|
||||||
|
@user = User.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
# POST /users
|
|
||||||
# POST /users.json
|
|
||||||
def create
|
|
||||||
@user = User.new(user_params)
|
|
||||||
|
|
||||||
if @user.save
|
|
||||||
render :show, status: :created, location: @user
|
|
||||||
else
|
|
||||||
render json: @user.errors, status: :unprocessable_entity
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# PATCH/PUT /users/1
|
|
||||||
# PATCH/PUT /users/1.json
|
|
||||||
def update
|
|
||||||
if @user.update(user_params)
|
|
||||||
render :show, status: :ok, location: @user
|
|
||||||
else
|
|
||||||
render json: @user.errors, status: :unprocessable_entity
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# DELETE /users/1
|
|
||||||
# DELETE /users/1.json
|
|
||||||
def destroy
|
|
||||||
@user.destroy
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
|
||||||
def set_user
|
|
||||||
@user = User.find(params[:id])
|
|
||||||
end
|
|
||||||
|
|
||||||
# Only allow a list of trusted parameters through.
|
|
||||||
def user_params
|
|
||||||
params.require(:user).permit(:username)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user