noosfero | Fix problem rendering Enviroment update errors in API (!1279)

Leandro Nunes gitlab at mg.gitlab.com
Mon Jul 10 18:18:43 BRT 2017


Leandro Nunes started a new discussion on app/api/v1/environments.rb:

>              authenticate!
>              environment = Environment.find_by(id: params[:id])
>              return forbidden! unless is_admin?(environment)
> -            environment.update_attributes!(params[:environment])
> -            status Api::Status::DEPRECATED if path == 'environment'
> -            present_partial environment, with: Entities::Environment, is_admin: is_admin?(environment), current_person: current_person
> +            begin
> +              environment.update_attributes!(params[:environment])
> +              status Api::Status::DEPRECATED if path == 'environment'
> +              present_partial environment, with: Entities::Environment, is_admin: is_admin?(environment), current_person: current_person
> +            rescue ActiveRecord::RecordInvalid
> +              render_model_errors!(environment.errors)

please make some tests for this condition

---
Reply to this email directly or view it on GitLab: https://gitlab.com/noosfero/noosfero/merge_requests/1279#note_34634868
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20170710/adb5c241/attachment-0001.html>


More information about the Noosfero-dev mailing list