[RUBY] [Error] How to resolve the event that the screen does not transition after editing

Overview

I implemented the task edit screen, edited it for confirmation, and pressed the button, but the screen did not change. .. .. .. : confounded:

As a result, it was not "redirect_to": sweat_smile :, but I will keep a memorandum of the process until the error was resolved!

Confirmation method

[Premise] After pressing the registration button on the edit screen, the button could not be pressed. No screen transitions are made. ① Check if the edited data is saved in MySQL → Changed: ok_hand:

(2) If the error screen does not appear, check that the error information is entered in the terminal.

terminal


No template found for TasksController#update, rendering head :no_content
Completed 204 No Content in 139ms (ActiveRecord: 3.4ms)

There was: rolling_eyes: It says ** No template **! !!

③ Check the controller → redirect_to is not listed: scream:

Modification place

Before correction

tasks_controller.rb


def update
  @task.update(task_params)
  if @task.valid?
    @task.save
  else
    flash.now[:alert] = 'Please enter the task name'
    render :index
  end
end

Revised

tasks_controller.rb


def update
  @task.update(task_params)
  if @task.valid?
    @task.save
    redirect_to group_tasks_path(@group), notice: 'Task changed'
  else
    flash.now[:alert] = 'Please enter the task name'
    render :index
  end
end

Please be careful, everyone: bow_tone1:

reference

URL for error 204. https://developer.mozilla.org/ja/docs/Web/HTTP/Status/204

Recommended Posts

[Error] How to resolve the event that the screen does not transition after editing
After introducing Better_errors, the error screen does not change
[Error resolution] How to resolve the error "Could not find a JavaScript runtime." After upgrading Catalina!
[Rails carrier wave] How to not transition to the error screen even if the image upload is not selected
How to interact with a server that does not crash the app
How to transition from the [Swift5] app to the iPhone settings screen
How to get the log when install4j does not start
How to solve the problem that the website image is not displayed after deploying to heroku on Rails 5
Correspond to "error that basic authentication does not pass" in the test code "The story that could not be done"
How to put out the error bundling
[Docker] How to solve the error function not implemented @ io_fread ~ [Super easy]
How to pass the value to another screen
How to constrain the action of the transition destination when not logged in
How to resolve the error'ActionView :: Template :: Error (The asset "application.css" is not present in the asset pipeline.'" When precompiling Rails assets
How to make @Transactional work that does not work if you use it incorrectly
How to resolve errors that occur in the "Ruby on Rails" integration test
[Grails] Error occurred running What to do when the Grails CLI does not start
How to find the cause of the Ruby error
Solved the problem that profile and logout were not displayed on the screen after signup.
[Swift] How to simply describe dismiss that was not taught in the introductory book
[rails devise] How to transition users who are not logged in to the login page
How to place a button that does not move by scrolling on TableView etc.
[Java] How to get the URL of the transition source
How to return to the previous screen by Swipe operation
How to send value in HTML without screen transition
How to move to the details screen by clicking the image
[Android Studio] [Java] How to fix the screen vertically
How to resolve SSL_connect error in PayPal Ruby SDK
The story that led to solving the error because postgres did not start with docker-compose up
Memo that transitions to the login screen if you are not logged in with devise
How to resolve Missing Template error when implementing comment function
[Rails] The problem that pry-byebug does not stop through breakpoints
[Rails] Solving the problem that session timeout does not work
How to replace characters that you do not understand [Principle]
Parse the redirected page (Jsoup uses Location to transition screen)
Display an error screen during the download process to response
How to deal with the error ERROR: While executing gem ... (Gem :: FilePermissionError)
I want to transition to the same screen in the saved state
How to solve the problem that you can not pull image from docker hub with Minikube
How to deal with the event that Committee :: InvalidRequest occurs in committee during Rspec file upload test