I have been having a problem with Rails lately where all the example code I’ve seen so far for sending data via POST is always routed to this default root URL which automatically calls a #create method in the controller. I wanted to know how do I go about making a form that sends data via POST but to a different method that I define?
In this particular example, I have a widget that needs to allow for file uploads. However, this upload could result in either a creation or a replace, but in either case it is only specific to this widget on the page. There are other widgets also capable of creating things and I need to keep the logic for them separated instead of just routing them all through some create method. How do I go about this?
This is how you make custom POST routes.
In routes,
In your whatever controller
And in your form for example