Sha256: e69ad931209cd86a366ddc27db3f9a3c1f5c7a25a8d06a2874e8419267b6280a

Contents?: true

Size: 725 Bytes

Versions: 8

Compression:

Stored size: 725 Bytes

Contents

# coding: utf-8


class Team < ActiveRecord::Base
  validates_numericality_of :division_id, :only_integer => true
  validates_presence_of :manager
  validates_numericality_of :founded, :only_integer => true
  validates_numericality_of :wins, :only_integer => true
  validates_numericality_of :losses, :only_integer => true
  validates_numericality_of :win_percentage
  validates_numericality_of :revenue, :allow_nil => true

  belongs_to :division
  has_many :players, :inverse_of => :team
  has_and_belongs_to_many :fans
  has_many :comments, :as => :commentable

  def player_names_truncated
    players.map{|p| p.name}.join(", ")[0..32]
  end

  def color_enum
    ['white', 'black', 'red', 'green', 'blu<e>é']
  end
end

Version data entries

8 entries across 8 versions & 4 rubygems

Version Path
rails_admin-0.0.1 spec/dummy_app/app/active_record/team.rb
obitum-rails_admin-0.0.5 spec/dummy_app/app/models/team.rb
drewda_rails_admin-0.0.1 spec/dummy_app/app/models/team.rb
obitum-rails_admin-0.0.4 spec/dummy_app/app/models/team.rb
obitum-rails_admin-0.0.3 spec/dummy_app/app/models/team.rb
obitum-rails_admin-0.0.2 spec/dummy_app/app/models/team.rb
obitum-rails_admin-0.0.1 spec/dummy_app/app/models/team.rb
elucid-rails_admin-0.0.1 spec/dummy_app/app/models/team.rb