panter/mykonote

View on GitHub
app/models/user.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

class User < ApplicationRecord
  devise :database_authenticatable,
         :recoverable, :rememberable, :trackable, :validatable, :registerable

  has_many :notes, dependent: :destroy

  enum :subscription, { free: 0, pro: 1 }

  before_create { self.subscription ||= :free }

  validates :password_confirmation, presence: true, on: :create
end