I have user
model with use of devise gem, I dont have attr_accessible
for any fields still I get the error:
Can't mass-assign protected attributes
My User
class as below
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable,
:token_authenticatable #, :validatable
end
I also have the same problem, maybe devise does something with attr_accessible
. You need to set up attr_accessible
in your model to make it work.
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :token_authenticatable #, :validatable`
# Setup accessible (or protected) attributes for your model
attr_accessible :first_name, :last_name, :email, :password, :password_confirmation
end
You can checkout these railscasts episodes.