Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Either route_short_name or route_long_name is required but not both #24

Open
geofflane opened this issue Jun 1, 2015 · 1 comment
Open

Comments

@geofflane
Copy link

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

@thestrauss3
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants