Sha256: 8be35e434dd68430c6ea563bbd3c2be242f2be09e4b50923d58c3133311eb164

Contents?: true

Size: 254 Bytes

Versions: 6

Compression:

Stored size: 254 Bytes

Contents

# frozen_string_literal: true

class LessonError < Exception
end

class Lesson < ActiveRecord::Base
  has_and_belongs_to_many :students
  before_destroy :ensure_no_students

  def ensure_no_students
    raise LessonError unless students.empty?
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
ibm_db-5.5.0 test/models/lesson.rb
ibm_db-5.4.1 test/models/lesson.rb
ibm_db-5.4.0 test/models/lesson.rb
ibm_db-5.3.2 test/models/lesson.rb
ibm_db-5.3.1 test/models/lesson.rb
ruby-on-quails-0.1.0 activerecord/test/models/lesson.rb