Rails: POST 422 (Unprocessable Entity) in Rails? Due to the routes or the controller?
I got it working!
I added a...
skip_before_action :verify_authenticity_token
to the controller.
The issue was found when checking out the logs and seeing that the CSRF token could not be verified.
422 Unprocessable Entity in rails
Adding this line at the start of upload_main_file function fixed the problem
skip_before_action :verify_authenticity_token
What causes a 422 Unprocessable Entity Error in Rails 3?
Turns out that it was this line that was causing this error:
@project = current_user.projects.build(params[:project])
I replaced the build
with create
and all works now.
Rails best_in_place Unprocessable Entity
I figured out what the problem was and how to fix it. We use an option to Save or Save As when editing materials. In the controller we therefore check for the params[:commit]
.
By editing the url I was able to send in the params[:commit]
with the update with best_in_place. Here is how the best_in_place code ended up like:
<%= best_in_place @material, :name, as: :input, url: material_path(@material, commit: "Save") %>
Related Topics
Node.Js - How to Set Environment Variables in Code
Shell Tool Which Renders Web Site Including JavaScript
Simulating Linux Terminal in Browser
Is "Monkey Patching" Really That Bad
Any Difference Between Await Promise.All() and Multiple Await
Last Segment of Url with JavaScript
Is There a JavaScript Function That Can Pad a String to Get to a Determined Length
Why Doesn't Indexof Work on an Array IE8
How to Perform SQL "Like" Operation on Firebase
Detect Urls in Text with JavaScript
Prevent Browser Caching of Ajax Call Result
How to Delete an Item from State Array
Dynamically Load a JavaScript File