class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable,
         :confirmable

  validates :email, presence: true, uniqueness: {case_sensitive: false}

  has_many :comments, :foreign_key => 'author_id'
end

class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable,
         :confirmable

  validates :name, presence: true, uniqueness: {case_sensitive: false}
  validates :email, presence: true, uniqueness: {case_sensitive: false}
  validates :encrypted_password, presence: true

  has_many :comments, :foreign_key => 'author_id'
end

Add name and password validations to User model
Add name and password validations to User model

Users are requires to have a unique name and an encrypted password.
Rails should not attempt to create a record if these fields are not
filled out in the devise registration form.
