ruby on rails - Devise: Foreign key columns for roles in user_id -


i used rails composer create starter app rails project. using devise create , manage roles

i have following roles user: recruiter, applicant user can 1 or both of [recruiter, applicant]

i looked @ user model , doesnt have foreign key role_id column. added column myself,and i facing following issues

1] app assigns role_id=1 every user sign up

2] user both recruiter , applicant, there 2 roles in user column different ids [1 , 2] , how would/should model handled.

this user model:

class user < activerecord::base   rolify   # include default devise modules. others available are:   # :token_authenticatable, :confirmable,   # :lockable, :timeoutable , :omniauthable   devise :database_authenticatable, :registerable,          :recoverable, :rememberable, :trackable, :validatable    # setup accessible (or protected) attributes model   attr_accessible :role_ids, :as => :admin   attr_accessible :name, :email, :password, :password_confirmation, :remember_me, :user_id, :role_ids   validates_presence_of :email    has_many :applications   has_many :jobs           end 


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -