Commit 9db75e4fc6439859e701fd51b35502e190466551
1 parent
68dae8a2
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
transforms error to array
Showing
1 changed file
with
3 additions
and
1 deletions
Show diff stats
lib/noosfero/api/helpers.rb
| ... | ... | @@ -55,7 +55,7 @@ require 'grape' |
| 55 | 55 | end |
| 56 | 56 | def multiple_search?(searches=nil) |
| 57 | 57 | ['index', 'category_index'].include?(params[:action]) || (searches && searches.size > 1) |
| 58 | - end | |
| 58 | + end | |
| 59 | 59 | #################################################################### |
| 60 | 60 | |
| 61 | 61 | def logger |
| ... | ... | @@ -299,8 +299,10 @@ require 'grape' |
| 299 | 299 | end |
| 300 | 300 | |
| 301 | 301 | def render_api_errors!(messages) |
| 302 | + messages = messages.to_a if messages.class == ActiveModel::Errors | |
| 302 | 303 | render_api_error!(messages.join(','), 400) |
| 303 | 304 | end |
| 305 | + | |
| 304 | 306 | protected |
| 305 | 307 | |
| 306 | 308 | def set_session_cookie | ... | ... |