From 72918ea9c5e08222038b6f5655fa948326096289 Mon Sep 17 00:00:00 2001 From: Vladimir Rozhkov Date: Wed, 19 Jul 2017 09:57:40 +0300 Subject: [PATCH] #930 Add instructions of how to disable some actions. --- 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`.