From 4386aa1ab08f164dcb4c4faa8024d1007b1d6ab0 Mon Sep 17 00:00:00 2001 From: Derek Ethier Date: Sat, 9 Apr 2016 22:46:22 -0400 Subject: [PATCH] Update initializer.rb to include the remove_role_if_empty option and description The default action is to remove roles if the last resource is removed. Important to disable this if the roles are associated with permissions (Pundit etc.) and cascades are enabled. I'd suggest changing the default action, but in absence of that, a small change to the initializer to include the option and description to change it. --- lib/generators/rolify/templates/initializer.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/generators/rolify/templates/initializer.rb b/lib/generators/rolify/templates/initializer.rb index 9c7a7c9c..0d25416d 100644 --- a/lib/generators/rolify/templates/initializer.rb +++ b/lib/generators/rolify/templates/initializer.rb @@ -4,4 +4,7 @@ # Dynamic shortcuts for User class (user.is_admin? like methods). Default is: false # config.use_dynamic_shortcuts -end \ No newline at end of file + + # Configuration to remove roles from database once the last resource is removed. Default is: true + # config.remove_role_if_empty = false +end