I'm using restangular with AngularJS 1.5 and Rails 5.x and have the following;
Restangular.all('wage_schedules').post($scope.wage_schedule).then (response) ->
$state.go "wage_schedules"
When this request gets to my Rails backend the params includes "wage_schedul" and it's missing the 'e' on the end. At first I thought it was Ruby on Rails and the inflection file but after playing around with that it still didn't work.
Is Restangular changing my wage_schedules to wage_schedul and how would I train it to correctly singularise 'wage_schedules' to 'wage_schedule'?
When I check my payload sent to the server from Restangular I can see that it's already called 'wage_schedul' without the 'e' on the end.
If I swap the syntax to
Restangular.all('jobs').post($scope.wage_schedule).then (response) ->
$state.go "wage_schedules"
Then I get job: {} in my post payload. So Restangular must be misinterpretting the conversion of wage_schedules to wage_schedule.
The answer was to use a package: https://github.com/blakeembrey/pluralize and configure it to be used with Restangular.