Home Sending multiple patch and post methods to the same location
Reply: 0

Sending multiple patch and post methods to the same location

user825
1#
user825 Published in April 22, 2018, 5:01 am

I have a page /users/:id as the show page for the users. On the show page I am trying to update 2 tables in the database. Will be 4 tables at the end. I'm using these routes to do it.

devise_for :users
resources :users, only: [:show] 

patch '/users/:id' => 'companyinfos#update'
post '/users/:id' => 'companyinfos#update'
patch '/users/:id' => 'socials#update'
post '/users/:id' => 'socials#update'

I'm running into an error when doing this. If I try to update information for socials#update it's directing me to companyinfos#update method, but when I update companyinfos it works just fine. I'm assuming because I listed companyinfos route first. How do I properly route to the same location and update multiple methods.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.344685 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO