handy_generators 0.1.10
## Usage ### Edit Links Helper ``` rails generate handy_generators:edit_links_helper ``` \n This generator will add a helper and a partial for displaying edit and delete links for a record. This uses pundit by default to check whether a user should be able to edit and/or delete the record before displaying the link. If you'd like to always display these links when you use the helper in the view or handle the logic yourself, simply add --pundit false to your command. \n ``` rails generate handy_generators:edit_links_helper --pundit false ``` \n #### Helpers `edit_links(record:, edit_classes: '', delete_classes: '')` The `edit_links` helper receives three parameters `record`, `edit_classes`, and `delete_classes`. Record is the only required parameter, `edit_classes` and `delete_classes` will be empty by default, if you'd like to add classes you can pass them as parameters to the helper. The default helper uses pundit, and it will check if the logged in user has permission to edit or delete the record before displaying the links. If not, it will display the edit or delete links to all users. `edit_record_link(record:, classes: '')` The `edit_record_link` helper will just display an edit link, it won't check if the user has permission before displaying the link. Classes that you pass in as a parameter will be applied to the link. `delete_record_link(record:, classes: '')` The `delete_record_link` helper will display just display a delete link, with a confirm. It also doesn't check if the user has permission before displaying the link. Classes that you pass in as a parameter will be applied to the link.