Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move documentation of how to disable some actions on controller #1534

Merged
merged 1 commit into from
Jan 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/customizing_controller_actions.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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