From c182f562419d227056ee333ef5328f4b8e4028eb Mon Sep 17 00:00:00 2001 From: Aitor Lopez Beltran Date: Thu, 23 Jan 2020 10:53:37 +0100 Subject: [PATCH] Move documentation of how to disable some actions on controller (#1534) --- docs/customizing_controller_actions.md | 13 +++++++++++++ docs/customizing_dashboards.md | 13 ------------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/customizing_controller_actions.md b/docs/customizing_controller_actions.md index e2f2f4d342..c0f058c19a 100644 --- a/docs/customizing_controller_actions.md +++ b/docs/customizing_controller_actions.md @@ -41,3 +41,16 @@ class Admin::FoosController < Admin::ApplicationController # end end ``` + +## Customizing Actions + +To enable or disable certain actions you could override `valid_action?` method in your dashboard controller like this: + +```ruby +# disable 'edit' and 'destroy' links +def valid_action?(name, resource = resource_class) + %w[edit destroy].exclude?(name.to_s) && super +end +``` + +Action is one of `new`, `edit`, `show`, `destroy`. diff --git a/docs/customizing_dashboards.md b/docs/customizing_dashboards.md index d1a535730e..4d4bf412bf 100644 --- a/docs/customizing_dashboards.md +++ b/docs/customizing_dashboards.md @@ -265,19 +265,6 @@ en: other: Happy Customers ``` -## Customizing Actions - -To enable or disable certain actions you could override `valid_action?` method in your dashboard controller like this: - -```ruby -# disable 'edit' and 'destroy' links -def valid_action?(name, resource = resource_class) - %w[edit destroy].exclude?(name.to_s) && super -end -``` - -Action is one of `new`, `edit`, `show`, `destroy`. - ## Collection Filters Resources can be filtered with pre-set filters. For example if we added: