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

Add custom ArgumentError for invalid to: values #50466

Merged

Commits on Jan 15, 2024

  1. Add custom ArgumentError for invalid to: values

    Previously, it was theoretically possible to define a route with a
    Symbol as a `to:` value (or at least, it would not raise a
    `NoMethodError`). However, passing a Symbol broke when `/#/.match?(to)`
    was [replaced][1] with `to&.include?("#")` with the assumption that `to`
    was always a String.
    
    Instead of restoring the previous error, this commit improves how the
    `to:` value is checked so that it raises an `ArgumentError` for any
    invalid values. The extra strictness will specifically improve the error
    when a Symbol or String that doesn't include a "#" are passed since they
    were effectively equivalent to passing a `nil` value, or not specifying
    `to:` at all.
    
    [1]: 5726b1d
    skipkayhil authored and rafaelfranca committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    0821d25 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a39332f View commit details
    Browse the repository at this point in the history