I've setup a new app with Devise in Rails 5 and added a custom field "username" to my User model. I added a validation for :username, presence: true and a not null specification in the database migration for the username column.
When I submit my new user form it passes the username validation on the model but is throwing a Postgres database error of "null value in column 'username' violates not-null constraint".
Additionally, when I try to create a new user in the console with User.create!({username: 'Test', email: '[email protected]', password: '12345', password_confirmation: '12345'}) it passes the model validation but throws the same Postgres database error of null value on the username column.
This indicates that the username is getting passed to the model for validation but not getting passed to the database and so Postgres is receiving a null value and throwing a not-null constraint error.
Is there a step I am missing in enabling Devise to accept a custom field on the User model? I've followed all the instructions that I could find from Googling but I seem to have a different problem than other people are experiencing.