forest-rails icon indicating copy to clipboard operation
forest-rails copied to clipboard

Notification when overriding a default route

Open jjf21 opened this issue 1 year ago • 1 comments

Expected behavior

When overriding a route, I can't edit the success notification:

Actual behavior

Here is my code:

# lib/forest_liana/controllers/organizations_controller.rb
if ForestLiana::UserSpace.const_defined?("OrganizationController")
  ForestLiana::UserSpace::OrganizationController.class_eval do

    def destroy
      organization_id = params[:id]
      Organizations::DestroyWorker.perform_async(organization_id)
      render status: 200, json: { success: "The organization #{organization_id} will be deleted soon!" }
    end

end

I always get "Organization deleted!" as notification

I've tried several way to render a success messages but non of them worked render status: 200, plain: success_message render status: 201, html: success_message

In smart actions it says : render json: { success: success_message }

Thanks for you help !

forest_liana (7.6.7)

jjf21 avatar Jun 13 '23 10:06 jjf21

Hello @jjf21,

Sadly, this as already been reported (https://community.forestadmin.com/t/how-to-set-the-message-of-the-banner-red-green-blue-returned-to-the-ui-on-action-completion/3337/1) and it's not supported. The way we handle error code/messages is pretty generic accross the application and we currently do not handle such customization on CRUD routes. I'm pushing your request to our product board, and be sure we will ping you when we'll tackle this topic.

matthv avatar Jun 13 '23 13:06 matthv