Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add status: :unprocessable_entity to all failed render responses #56

Merged
merged 1 commit into from
Jan 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class UsersController < ApplicationController
if @user.save
redirect_to root_path, notice: "Please check your email for confirmation instructions."
else
render :new
render :new, status: :unprocessable_entity
end
end

Expand Down Expand Up @@ -525,11 +525,11 @@ class SessionsController < ApplicationController
redirect_to root_path, notice: "Signed in."
else
flash.now[:alert] = "Incorrect email or password."
render :new
render :new, status: :unprocessable_entity
end
else
flash.now[:alert] = "Incorrect email or password."
render :new
render :new, status: :unprocessable_entity
end
end

Expand Down Expand Up @@ -754,11 +754,11 @@ class PasswordsController < ApplicationController
redirect_to login_path, notice: "Signed in."
else
flash.now[:alert] = @user.errors.full_messages.to_sentence
render :edit
render :edit, status: :unprocessable_entity
end
else
flash.now[:alert] = "Incorrect email or password."
render :new
render :new, status: :unprocessable_entity
end
end

Expand Down Expand Up @@ -1333,7 +1333,7 @@ class SessionsController < ApplicationController
end
else
flash.now[:alert] = "Incorrect email or password."
render :new
render :new, status: :unprocessable_entity
end
end
...
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/passwords_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ def update
redirect_to login_path, notice: "Password updated."
else
flash.now[:alert] = @user.errors.full_messages.to_sentence
render :edit
render :edit, status: :unprocessable_entity
end
else
flash.now[:alert] = "Incorrect email or password."
render :new
render :new, status: :unprocessable_entity
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def create
end
else
flash.now[:alert] = "Incorrect email or password."
render :new
render :new, status: :unprocessable_entity
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def create
@user.send_confirmation_email!
redirect_to root_path, notice: "Please check your email for confirmation instructions."
else
render :new
render :new, status: :unprocessable_entity
end
end

Expand Down