lib/sportdb/models/track.rb in sportdb-1.6.12 vs lib/sportdb/models/track.rb in sportdb-1.6.13

- old
+ new

@@ -11,11 +11,11 @@ ### fix: move known_tracks_table to event!!! (e.g. scoped by event) def self.known_tracks_table - @@known_tracks_table ||= build_match_table_for( Track.all ) + @@known_tracks_table ||= TextUtils.build_title_table_for( Track.all ) end # method known_tracks_table def self.create_or_update_from_values( new_attributes, values ) @@ -25,9 +25,11 @@ ## check optional values values.each_with_index do |value, index| if value =~ /^[a-z]{2}$/ ## assume two-letter country key e.g. at,de,mx,etc. value_country = Country.find_by_key!( value ) new_attributes[ :country_id ] = value_country.id + elsif value =~ /^[A-Z]{3}$/ ## assume three-letter code e.g. AUS, MAL, etc. + new_attributes[ :code ] = value else ## todo: assume title2 ?? ## assume title2 if title2 is empty (not already in use) ## and if it title2 contains at least two letter e.g. [a-zA-Z].*[a-zA-Z] # issue warning: unknown type for value \ No newline at end of file