Ali Zaidi

Joined

3,810 Experience
38 Lessons Completed
0 Questions Solved

Activity

Posted in Liking Posts Discussion

Hi Chris,

When I make the AJAX request to like a post I receive the following error in the console:

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

The logs show the following error:

Rack app error handling request { POST /posts/7/like }

#<ActionController::UnknownHttpMethod: POST, accepted HTTP methods are OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT, PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK, UNLOCK, VERSION-CONTROL, REPORT, CHECKOUT, CHECKIN, UNCHECKOUT, MKWORKSPACE, UPDATE, LABEL, MERGE, BASELINE-CONTROL, MKACTIVITY, ORDERPATCH, ACL, SEARCH, MKCALENDAR, and PATCH>

Back in the console the error links to the rails-ujs file and shows me the error at the following location:

if (xhr.readyState === XMLHttpRequest.OPENED) {
**  return xhr.send(options.data);
**}

I'm running on Rails 5.2 if that helps.

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.