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

Evandro Jr gitlab at mg.gitlab.com
Mon Jul 10 19:15:16 BRT 2017


Evandro Jr commented on a 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)

Done!

---
Reply to this email directly or view it on GitLab: https://gitlab.com/noosfero/noosfero/merge_requests/1279#note_34637817
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/ca15de97/attachment.html>


More information about the Noosfero-dev mailing list