Sha256: a5633eeede1ccde8b6a54481c2db2138e8c9c1a6c408783b651f71ce3d34b4ce

Contents?: true

Size: 303 Bytes

Versions: 20

Compression:

Stored size: 303 Bytes

Contents

class Team < ActiveRecord::Base
  has_and_belongs_to_many :people

  validates :name, presence: true
  validate :no_more_than_two_people_per_team

  def no_more_than_two_people_per_team
    if people.length > 2
      errors.add(:people, "A maximum of two persons per team is allowed")
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
deferring-0.8.2 spec/support/models/team.rb
deferring-0.8.1 spec/support/models/team.rb
deferring-0.8.0 spec/support/models/team.rb
deferring-0.7.1 spec/support/models/team.rb
deferring-0.7.0 spec/support/models/team.rb
deferring-0.6.2 spec/support/models/team.rb
deferring-0.6.1 spec/support/models/team.rb
deferring-0.6.0 spec/support/models/team.rb
deferring-0.5.0 spec/support/models/team.rb
deferring-0.4.1 spec/support/models/team.rb
deferring-0.4.0 spec/support/models/team.rb
deferring-0.3.0 spec/support/models/team.rb
deferring-0.2.1 spec/support/models/team.rb
deferring-0.2.0 spec/support/models/team.rb
deferring-0.1.5 spec/support/models/team.rb
deferring-0.1.4 spec/support/models/team.rb
deferring-0.1.3 spec/support/models/team.rb
deferring-0.1.2 spec/support/models/team.rb
deferring-0.1.1 spec/support/models/team.rb
deferring-0.1.0 spec/support/models/team.rb