fga-gpp-mds/2017.1-Escola-X

View on GitHub
app/models/classroom.rb

Summary

Maintainability
A
0 mins
Test Coverage
#File name: classroom.rb
#Class name: Classroom
#Description: Validates classroom's attributes
class Classroom < ApplicationRecord
  has_many :alumns
  has_many :classroom_subjects, dependent: :destroy
  has_many :grades
  has_many :subjects, through: :classroom_subjects
  belongs_to :classroom_grade
  belongs_to :shift
  accepts_nested_attributes_for :alumns

  validates :name_classroom, presence: { message: "não pode estar em branco" },
           length: { minimum: 1,
                     maximum: 5,
                     :too_short => "deve possuir no mínimo 1 caracter",
                     :too_long => "deve possuir no máximo 5 caracteres" }

end