Class RacingAssociation
In: app/models/racing_association.rb
Parent: ActiveRecord::Base

OBRA, WSBA, USA Cycling, etc … Many defaults. Override in environment.rb. Stored in RacingAssociation.current constant. bar_point_schedule should be stored in the database with the BAR?

cx_memberships? Offers cyclocross memberships eager_match_on_license? Trust license number in results? Use it to match People instead of name. search_results_limit: Limit number of people, teams, etc. returned in search

Methods

Attributes

now  [RW] 
person  [RW] 
rental_numbers  [RW] 

Public Class methods

[Source]

    # File app/models/racing_association.rb, line 54
54:   def self.current
55:     @current ||= RacingAssociation.first || RacingAssociation.create
56:   end

[Source]

    # File app/models/racing_association.rb, line 58
58:   def self.current=(value)
59:     @current = value
60:   end

Public Instance methods

[Source]

    # File app/models/racing_association.rb, line 92
92:   def effective_today
93:     if now.month < 12
94:       Date.new(now.year)
95:     else
96:       Date.new(now.year + 1)
97:     end
98:   end

"Membership year." Used for race number export, schedule, and renewals. Returns current year until December. On and after December 1, returns the next year.

[Source]

    # File app/models/racing_association.rb, line 84
84:   def effective_year
85:     if now.month < 12
86:       now.year
87:     else
88:       now.year + 1
89:     end
90:   end

Date.today.year + 1 unless now is set.

[Source]

     # File app/models/racing_association.rb, line 101
101:   def next_year
102:     now.year + 1
103:   end

Defaults to Time.now, but can be explicitly set for tests or data cleanup

[Source]

    # File app/models/racing_association.rb, line 68
68:   def now
69:     @now || Time.zone.now
70:   end

Person record for RacingAssociation

[Source]

    # File app/models/racing_association.rb, line 63
63:   def person
64:     @person ||= Person.find_or_create_by_name(short_name)
65:   end

[Source]

     # File app/models/racing_association.rb, line 105
105:   def priority_country_options
106:     if country_code == "US"
107:       [ ['United States', 'US'], ['Canada', 'CA'] ]
108:     else
109:       [ ['Canada', 'CA'], ['United States', 'US'] ]
110:     end
111:   end

[Source]

     # File app/models/racing_association.rb, line 113
113:   def to_s
114:     "#<RacingAssociation #{short_name} #{name}>"
115:   end

Returns now.beginning_of_day, which is the same as Date.today. But can be explicitly set for tests or data cleanup.

[Source]

    # File app/models/racing_association.rb, line 73
73:   def today
74:     now.to_date
75:   end

Returns now.year, which is the same as Date.today. But can be explicitly set for tests or data cleanup.

[Source]

    # File app/models/racing_association.rb, line 78
78:   def year
79:     now.year
80:   end

[Validate]