Difference between zero: false and required: true in rails
In rail travel, what is the difference between null: false
and required: true
?
For example, if I write:
t.string :phone_number, required: true
this is the same as:
t.string :phone_number, null: false
If they are different, how are they different from each other?
Thank you in advance:)
+3
source to share
1 answer
required:true
does nothing when migrating. Perhaps you are confused about what Active Record Validations are ?
TL; DR: use null:false
.
+5
source to share