gtfs
gtfs copied to clipboard
Either route_short_name or route_long_name is required but not both
According to the spec:
At least one of route_short_name or route_long_name must be specified, or potentially both if appropriate. If the route does not have a short name, please specify a route_long_name and use an empty string as the value for this field.
The current validation on a Route requires both short_name and long_name and so those missing one of the values will be excluded from the data returned.
https://developers.google.com/transit/gtfs/reference#routes_fields
I believe the way that it's stated, its requiring transit feeds to include both a short_name AND a long_name, BUT since a route REALLY only needs one or the other, it's okay to have one of them be an empty string. However the field is still required and null values will not be accepted. Theoretically you could add a validation for this still:
validate :name_is_present
def name_is_present
if self.short_name.empty? && self.long_name.empty?
self.errors.add :base, 'Route must have a name'
end
end