I'm trying to apply the technique here to manually generate a password with devise and save it along with other attributes.
I'm using
password = "iamben"
@user = User.new(first_name: "Ben", email: "ben@mail.com", encrypted_password: password).encrypted_password
@user.save
NoMethodError (undefined method `save' for "iamben":String)
I am not sure why it doesn't work. I also tried a couple of other attempts
@user = User.new(first_name: "Ben", email: "ben@mail.com", encrypted_password: password.encrypted_password)
and
@user = User.new(first_name: "Ben", email: "ben@mail.com", encrypted_password: encrypted_password(password))
Sorry, it's probably something very simple I am doing incorrectly
I had a few points of confusion, but the answer essentially boils down to what we find here.
Simply
user = User.where(email: "ben@mail.com")
user.password = "123abc"
user.save
123abc