Sha256: 56794ac67e6ac356f44d0c06451bceefe1137d4868a3612f1dbc35f04d2d3f19
Contents?: true
Size: 482 Bytes
Versions: 2
Compression:
Stored size: 482 Bytes
Contents
class RoomAssignment < ActiveRecord::Base self.primary_keys = :student_id, :dorm_id, :room_id belongs_to :student belongs_to :room, :foreign_key => [:dorm_id, :room_id], :primary_key => [:dorm_id, :room_id] validates :student_id, uniqueness: { conditions: ->(record) { where(student_id: record.student_id) # enough just to exercise this code path } } before_destroy do |record| puts record end after_destroy do |record| puts record end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
composite_primary_keys-14.0.9 | test/fixtures/room_assignment.rb |
composite_primary_keys-14.0.8 | test/fixtures/room_assignment.rb |