ruby on rails - Problems with has_secure_password -



ruby on rails - Problems with has_secure_password -

i'm trying create user model uses has_secure_password, i've followed examples rails documentation , still fails.

this model:

class user < activerecord::base attr_accessible :username, :email, :full_name, :password_digest has_secure_password end

and i'm trying create user so:

@user = user.new({ username: params[:user][:username], password: params[:user][:password], password_confirmation: params[:user][:password_confirmation], email: params[:user][:email], full_name: params[:user][:full_name] }) # tried `@user.new(params[:user])`

however i'm getting error:

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

i've tried searching solutions on here , google, taken @ "sample apps" , appear doing same are, except i'm still getting error.

is there i'm doing wrong or missing?

try adding :password, :password_confirmation attr_accessible, might problem.

ruby-on-rails passwords

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -