How do turn off validation in Rails 3.2.3
in seeds.rb
? I did this
u1 = User.create email: '[email protected]', password: '123', validate: false
but it said Can't mass-assign protected attributes: validate
. I know what it means. So how do I get rid of that error?
You can do
u1 = User.new(email: '[email protected]', password: '123').save(validate: false)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With