Remove turbo_stream views
Was barking up the wrong tree introducing these. The solution to the issue of forms not re-rendering was to return the :unprocessable_entity status when errors are encountered.
This commit is contained in:
parent
107c2e62a8
commit
552935f5c7
|
@ -12,7 +12,7 @@ class SessionsController < ApplicationController
|
||||||
redirect_to @user, notice: t(".logged_in")
|
redirect_to @user, notice: t(".logged_in")
|
||||||
else
|
else
|
||||||
flash.now.alert = t(".login_fail")
|
flash.now.alert = t(".login_fail")
|
||||||
render :new
|
render :new, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class UsersController < ApplicationController
|
||||||
redirect_to root_path, notice: t(".account_created")
|
redirect_to root_path, notice: t(".account_created")
|
||||||
else
|
else
|
||||||
flash.now.alert = t(".create_failed")
|
flash.now.alert = t(".create_failed")
|
||||||
render :new
|
render :new, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ class UsersController < ApplicationController
|
||||||
redirect_to @user, notice: t(".account_updated")
|
redirect_to @user, notice: t(".account_updated")
|
||||||
else
|
else
|
||||||
flash.now.alert = t(".update_failed")
|
flash.now.alert = t(".update_failed")
|
||||||
render :edit
|
render :edit, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
<% @title = "Log in" %>
|
|
||||||
|
|
||||||
<%= update_flash %>
|
|
||||||
|
|
||||||
<%= turbo_stream.replace "session_form" do %>
|
|
||||||
<%= form_with url: sessions_path, method: :post, id: "session_form" do |f| %>
|
|
||||||
<h2><%= t ".log_in" %></h2>
|
|
||||||
|
|
||||||
<%= f.label :username %>
|
|
||||||
<%= f.text_field :username %>
|
|
||||||
|
|
||||||
<%= f.label :password %>
|
|
||||||
<%= f.password_field :password %>
|
|
||||||
|
|
||||||
<%= f.submit t(".log_in") %>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
|
@ -1,12 +0,0 @@
|
||||||
<% @title = "Edit account details" %>
|
|
||||||
|
|
||||||
<%= update_flash %>
|
|
||||||
|
|
||||||
<%= turbo_stream.replace "user_form" do %>
|
|
||||||
<%= render partial: "form",
|
|
||||||
locals: {
|
|
||||||
user: @user,
|
|
||||||
button_text: t(".edit"),
|
|
||||||
title: t(".edit"),
|
|
||||||
} %>
|
|
||||||
<% end %>
|
|
|
@ -1,12 +0,0 @@
|
||||||
<% @title = "Register" %>
|
|
||||||
|
|
||||||
<%= update_flash %>
|
|
||||||
|
|
||||||
<%= turbo_stream.replace "user_form" do %>
|
|
||||||
<%= render partial: "form",
|
|
||||||
locals: {
|
|
||||||
user: @user,
|
|
||||||
button_text: t(".register"),
|
|
||||||
title: t(".register"),
|
|
||||||
} %>
|
|
||||||
<% end %>
|
|
Loading…
Reference in New Issue