angularjs - Rails console - TypeError: can't cast Hash to string -
a little background first, able - angular/rails project working on local
i went change user/password in sqlite3 , here steps took
rails c = user.find(1) a.name = "myname" a.password_digest = "mysurname" a.save great, worked! not
well, kind of, angular app looking password looks - $2a$10$trtjncwr5klww2h9ajr45u8mwldo2erefqp1/ixc.8kw...
after doing digging, i found stackoverflow answer
followed me trying following:
a = user.find(1) filters = rails.application.config.filter_parameters f = actiondispatch::http::parameterfilter.new filters b = f.filter :password_digest => 'mysurname' a.password_digest = b which results in error in subject line of post - typeerror: can't cast hash string, followed (0.1ms) rollback transaction , tons of lines of references .rb files
so, ultimate question is, how update record has filter on password field, while using rails console?
thanks in advance
you should read on password hashing , storage, password should never stored plaintext. hunch, try instead:
a = user.find(1) a.name = "whatever" a.password = "something" a.save in devise (and others) password setter defined user model automatically stores hash of password in password_digest column.
Comments
Post a Comment