Created
March 3, 2021 17:23
-
-
Save ignaciojonas/f487bf63d142942ebcef2bad137fbf3a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def update | |
respond_to do |format| | |
if @style.update(style_params) | |
format.html { redirect_to styles_url, notice: "Style was successfully updated." } # Cambió el redirect_to | |
format.json { render :show, status: :ok, location: @style } | |
else | |
#Agrego esta linea | |
format.turbo_stream { render turbo_stream: turbo_stream.replace(@style, partial: "styles/form", locals: { style: @style}) } | |
format.html { render :edit, status: :unprocessable_entity } | |
format.json { render json: @style.errors, status: :unprocessable_entity } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment