has_one association rails code example
Example 1: activerecord through
class Doctor < ApplicationRecord
has_many :patients, through: :consultation
end
Example 2: has_one rails
has_one :beneficiary
Example 3: active record dependent destroy
has_many :books, dependent: :destroy