In my development and test environments, I want to seed the database with a bunch of users. I\'m using Ruby on Rails v3.2.8 and the latest Devise. So I added this line in
You have to do like this:
user = User.new
user.email = 'test@example.com'
user.encrypted_password = '#$taawktljasktlw4aaglj'
user.save!
Read this guide to understand what mass-assignment is: http://guides.rubyonrails.org/security.html
I am wondering why do have to directly set the encrypted password. You could do this:
user.password = 'valid_password'
user.password_confirmation = 'valid_password'