Sha256: 8d4bfd6d7ddd1a4e562727c9261a9c49516c550ca6702b929d5b2eec4984a32d

Contents?: true

Size: 223 Bytes

Versions: 22

Compression:

Stored size: 223 Bytes

Contents

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

22 entries across 22 versions & 3 rubygems

Version Path
ibm_db-5.2.0 test/models/lesson.rb
ibm_db-5.1.0 test/models/lesson.rb
ibm_db-5.0.5 test/models/lesson.rb
ibm_db-5.0.4 test/models/lesson.rb
ibm_db-5.0.3 test/models/lesson.rb
ibm_db-5.0.2 test/models/lesson.rb
ibm_db-4.0.0-x86-mingw32 test/models/lesson.rb
ibm_db-4.0.0 test/models/lesson.rb
ibm_db-3.0.4-x86-mingw32 test/models/lesson.rb
ibm_db-3.0.4 test/models/lesson.rb
ibm_db-3.0.3-x86-mingw32 test/models/lesson.rb
ibm_db-3.0.3 test/models/lesson.rb
ibm_db-3.0.2-x86-mingw32 test/models/lesson.rb
ibm_db-3.0.2 test/models/lesson.rb
activejob-lock-0.0.2 rails/activerecord/test/models/lesson.rb
ibm_db-3.0.1 test/models/lesson.rb
ibm_db-3.0.1-x86-mingw32 test/models/lesson.rb
activejob-lock-0.0.1 rails/activerecord/test/models/lesson.rb
activerecord-nuodb-adapter-2.0.3 test/models/lesson.rb
activerecord-nuodb-adapter-2.0 test/models/lesson.rb