From fec0331b0c98d2a04f4199fc882eb3f07ad32d27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?W=C5=82odzimierz=20Ro=C5=BCkow?= Date: Thu, 20 Jul 2017 12:37:51 +0300 Subject: [PATCH] Add instructions of how to disable some actions. (#940) --- docs/customizing_dashboards.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/customizing_dashboards.md b/docs/customizing_dashboards.md index c23e88a4d2..e4299376c4 100644 --- a/docs/customizing_dashboards.md +++ b/docs/customizing_dashboards.md @@ -157,3 +157,16 @@ end ```` [define your own]: /adding_custom_field_types + +## 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`.