Sha256: 635f78fbf47c5b572c075a21acf5802c8b58005f939b71a1dbd949145b5faaae
Contents?: true
Size: 540 Bytes
Versions: 2
Compression:
Stored size: 540 Bytes
Contents
class Player < Sequel::Model set_primary_key(:id) plugin(:timestamps, :update_on_create => true) plugin(:validation_helpers) many_to_one(:team) one_to_many(:drafts, :one_to_one => true) self.raise_on_save_failure = false self.raise_on_typecast_failure = false def validate validates_numeric(:number, :only_integer => true) validates_unique(:number, :message => "There is already a player with that number on this team") do |dataset| dataset.where("team_id = ?", team_id) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
merb-admin-0.8.5 | spec/models/sequel/player.rb |
merb-admin-0.8.3 | spec/models/sequel/player.rb |