Sha256: 1510fcf8c648b3885415c71786575e2c92fac3a86b831f48754c249e84aa5df4

Contents?: true

Size: 369 Bytes

Versions: 10

Compression:

Stored size: 369 Bytes

Contents

module Gaku
  class SchoolYear < ActiveRecord::Base

    has_many :semesters

    validates :starting, :ending, presence: true

    validate :ending_after_starting

    private

    def ending_after_starting
      return if  starting.blank? && ending.blank?
      errors.add(:base, I18n.t(:'school_year.ending_after_starting')) if starting >= ending
    end

  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
gaku-0.1.1 core/app/models/gaku/school_year.rb
gaku_core-0.1.1 app/models/gaku/school_year.rb
gaku-0.1.0 core/app/models/gaku/school_year.rb
gaku_core-0.1.0 app/models/gaku/school_year.rb
gaku_core-0.0.3 app/models/gaku/school_year.rb
gaku-0.0.3 core/app/models/gaku/school_year.rb
gaku-0.0.2 core/app/models/gaku/school_year.rb
gaku_core-0.0.2 app/models/gaku/school_year.rb
gaku-0.0.1 core/app/models/gaku/school_year.rb
gaku_core-0.0.1 app/models/gaku/school_year.rb