Sha256: 159a2e9dfdab32d3cb4f41b338b572e6ed62a931a4b2299f2b615fe4a0ad164a

Contents?: true

Size: 685 Bytes

Versions: 5

Compression:

Stored size: 685 Bytes

Contents

class Team < Sequel::Model
  set_primary_key(:id)
  plugin(:timestamps, :update_on_create => true)
  plugin(:validation_helpers)

  many_to_one(:league)
  many_to_one(:division)
  one_to_many(:players)

  self.raise_on_save_failure = false
  self.raise_on_typecast_failure = false
  def validate
    validates_numeric(:league_id, :only_integer => true)
    validates_numeric(:division_id, :only_integer => true)
    validates_presence(:name)
    validates_presence(:manager)
    validates_numeric(:founded, :only_integer => true)
    validates_numeric(:wins, :only_integer => true)
    validates_numeric(:losses, :only_integer => true)
    validates_numeric(:win_percentage)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
merb-admin-0.6.4 spec/models/sequel/team.rb
merb-admin-0.6.3 spec/models/sequel/team.rb
merb-admin-0.6.2 spec/models/sequel/team.rb
merb-admin-0.6.1 spec/models/sequel/team.rb
merb-admin-0.6.0 spec/models/sequel/team.rb