| 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
| now | [RW] | |
| person | [RW] | |
| rental_numbers | [RW] |
# File app/models/racing_association.rb, line 54
54: def self.current
55: @current ||= RacingAssociation.first || RacingAssociation.create
56: end
# File app/models/racing_association.rb, line 58
58: def self.current=(value)
59: @current = value
60: end
# 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.
# 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
Defaults to Time.now, but can be explicitly set for tests or data cleanup
# File app/models/racing_association.rb, line 68
68: def now
69: @now || Time.zone.now
70: end
Person record for RacingAssociation
# File app/models/racing_association.rb, line 63
63: def person
64: @person ||= Person.find_or_create_by_name(short_name)
65: end
# 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
# File app/models/racing_association.rb, line 113
113: def to_s
114: "#<RacingAssociation #{short_name} #{name}>"
115: end