Sha256: 241553fb946f7f1164e4642e7f295cab7c78a6236b67355d4616d16c6bed00e7

Contents?: true

Size: 234 Bytes

Versions: 8

Compression:

Stored size: 234 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

8 entries across 8 versions & 1 rubygems

Version Path
ibm_db-5.2.0-x86-mingw32 test/models/lesson.rb
ibm_db-5.1.0-x86-mingw32 test/models/lesson.rb
ibm_db-5.0.5-x86-mingw32 test/models/lesson.rb
ibm_db-5.0.4-x86-mingw32 test/models/lesson.rb
ibm_db-5.0.3-x86-mingw32 test/models/lesson.rb
ibm_db-5.0.2-x86-mingw32 test/models/lesson.rb
ibm_db-3.0.5-x86-mingw32 test/models/lesson.rb
ibm_db-3.0.5 test/models/lesson.rb