I'm new to CanCanCan and am using it with Rails 4.2. My dev team doesn't like the idea of the roles being hard-coded in the user object (ie - ROLES=%i[admin user].freeze) so they've asked me to put them in a table. They also need access to this info from a different application and a reporting system.
I'm having problems moving the roles to its own table and cannot seem to find the correct documentation for this.
It seems to me the User object is running its code during the migration for some reason. For example, I replaced ROLES=xxx with something like Role.all.collectP{|x| x.to_sym}. The error is occurring on the Role.all method call.
I've created a Role model by calling rails g model name:string{25} description:string{100}). I then attempt to run rake db:migrate and get the error.
I'm a little confused as to why the table needs to exist when I am running the migration. After all, isn't the entire purpose of the migration to create the table?
Any help would be greatly appreciated. Thanks.
--
Scott
www.YourPathToAdventure.com