Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add instructions of how to disable some actions.
Add IntelliJ-generated files to .gitignore.
  • Loading branch information
rozhok committed Jul 19, 2017
1 parent a2a6931 commit fa3c3cc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@
/tmp/*
/spec/example_app/tmp/*
pkg
*.ipr
*.iml
*.iws
.idea
13 changes: 13 additions & 0 deletions docs/customizing_dashboards.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

0 comments on commit fa3c3cc

Please sign in to comment.