I've just started using Rolify and want to define the roles statically in the roles table, I've read the GitHub documentation and searched online.
Bard AI suggested that the following would do what I need ( rolify skip_create_role: true ) but I found no documentation on this and it doesn't seem to work.
I'm using the ( config.remove_role_if_empty = false ) in the config/initializers/rolify.rb file which fixes the deleting of roles if they are not in use, however I cannot find a way to stop roles from being automatically created.
class User < ApplicationRecord
has_secure_password
rolify skip_create_role: true
validates etc, etc
end
Rolify.configure do |config|
# By default ORM adapter is ActiveRecord. uncomment to use mongoid
# config.use_mongoid
# Dynamic shortcuts for User class (user.is_admin? like methods). Default is: false
# config.use_dynamic_shortcuts
# Configuration to remove roles from database once the last resource is removed. Default is: true
config.remove_role_if_empty = false
end