You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a user class namespaced in a user_base module, below are the two models
role model
module Userbase
class Role < ApplicationRecord
has_and_belongs_to_many :users, :join_table => :users_roles
belongs_to :resource,
:polymorphic => true,
:optional => true
validates :resource_type,
:inclusion => { :in => Rolify.resource_types },
:allow_nil => true
scopify
end
end
user model
module Userbase
class User < ApplicationRecord
rolify
end
end
I get the following error when I try to add a role to a user user.add_role? :admin NameError: uninitialized constant Role
I am not sure why I am getting this error.
The join table is users_roles as expected
The text was updated successfully, but these errors were encountered:
I have a user class namespaced in a user_base module, below are the two models
role model
user model
I get the following error when I try to add a role to a user
user.add_role? :admin
NameError: uninitialized constant Role
I am not sure why I am getting this error.
The join table is
users_roles
as expectedThe text was updated successfully, but these errors were encountered: