Skip to content

Commit

Permalink
Move documentation of how to disable some actions on controller (#1534)
Browse files Browse the repository at this point in the history
  • Loading branch information
aitorlb authored and pablobm committed Jan 23, 2020
1 parent 0d31a3c commit c182f56
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
13 changes: 13 additions & 0 deletions docs/customizing_controller_actions.md
Expand Up @@ -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`.
13 changes: 0 additions & 13 deletions docs/customizing_dashboards.md
Expand Up @@ -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:
Expand Down

0 comments on commit c182f56

Please sign in to comment.