If you are using the Rolify gem to manage user roles in your Rails app, you may have sometimes encountered a problem which will prevent you from starting the Rails app if ever the database table for Rolify wasn’t present, even if cases when you don’t need Rolify or the database.
To prevent this from happening and make your Rails app start again even when the database table for Rolify aren’t present or accessible, add this initialiser:
# config/initializers/rolify.rb Rolify.configure do |config| if ActiveRecord::Base.connection.table_exists? 'roles' config.use_dynamic_shortcuts end end
If your role object is called something other than “Role,” for example, “AdminRole,” specify the name as the first argument of “configure” above:
Rolify.configure 'AdminRole' do |config| # ...
The above was tested with Rolify 4.0.0 on Rails 4.2.1 as well as Rolify 3.4.1 on Rails 4.1.6. It is possible the issue was resolved in Rolify 5.0.0.