-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make user_id a required field on
/api/v1/regions/:id/surveys
endpoint
Also add some basic tests for the endpoint
- Loading branch information
1 parent
3ec2711
commit 4d117ae
Showing
4 changed files
with
32 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
module Api::V1::ErrorsHelper | ||
def render_api_errors(model) | ||
@errors = model.errors.full_messages | ||
def render_api_errors(model: nil, message: nil) | ||
@errors = if model | ||
model.errors.full_messages | ||
else | ||
[message] | ||
end | ||
|
||
render 'api/v1/common/errors', status: :unprocessable_entity, formats: :json | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters