0

In rails the routes can be created using

resources :vehicals

so, that will create many routes which will produce the basic routes required for the CRUD operation, But I am confused between the 2 routes i.e.

PATCH  /vehicals/:id(.:format)        vehicals#update
PUT    /vehicals/:id(.:format)        vehicals#update

please clear which is to use while update.

NM Pennypacker
  • 6,704
  • 11
  • 36
  • 38
vidur punj
  • 5,019
  • 4
  • 46
  • 65

1 Answers1

3

In rails there's no effective difference, and you can see from your routes that they call the same controller action.

Because rails only updates fields that are included in the view form and leaves other fields unchanged, it effectively has always implemented "PATCH" logic even before 'PATCH' was ever officially introduced.

Current Rails forms default to method post for sending new records and patch for updating existing records.

SteveTurczyn
  • 36,057
  • 6
  • 41
  • 53