Disable verification in seeds.rb

How to disable check in Rails 3.2.3in seeds.rb? I did it

u1 = User.create email: 'my@email.com', password: '123', validate: false

but he said Can't mass-assign protected attributes: validate. I know what that means. So how do I get rid of this error?

+5
source share
1 answer

You can do

u1 = User.new(email: 'my@email.com', password: '123').save(validate: false)
+16
source

All Articles