ruby on rails - ActiveAdmin: Can't mass-assign protected attributes: email, password, password_confirmation -


i having rails activeadmin devise authentication. have adminuser , user models user model doesn't have care admin. however, cannot create/edit neither adminuser nor user inside admin page. every time try doing so, give me message

can't mass-assign protected attributes: email, password, password_confirmation 

that's weird because inside user model , adminuser models, have:

attr_accessible :email, :password, :password_confirmation 

to try other way, went rails console , try creating adminuser , worked:

adminuser.create(:email => 'asdf@admin2.com',      :password => 'password', :password_confirmation => 'password') 

that means creation admin web page failed.

i using devise authentication. error occurs both user , adminuser models.

for password , password_confirmation, don't have fields in database, way devise default, never have password in database.

here user model:

devise :database_authenticatable, :registerable, :rememberable, :recoverable, :trackable, :omniauthable, :omniauth_providers => [:facebook]          ##, :validatable    # setup accessible (or protected) attributes model   attr_accessible :email, :password, :password_confirmation, :remember_me, :provider, :uid    # attr_accessible :title, :body     validates :email, :password, :first_name, :last_name,               presence: true     validates :email, uniqueness: true    has_many :devices   has_many :posts 

i change

attr_accessible :email, :password, :password_confirmation, :remember_me, :provider, :uid 

to

attr_accessible :email, :password, :password_confirmation, :remember_me, :provider, :uid, :as => [:default, :admin] 

and works.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -