has_one rails code example Example 1: has_one rails has_one :beneficiary Example 2: active record dependent destroy has_many :books, dependent: :destroy