Commit 142d137
committed
Add hyphenated/CamelCase controller name in routes to: pattern
Rails 4 validates controller names in `to:` clauses with strict
rules: no hyphens, no CamelCase. Hyphenated values raise
ArgumentError: 'foo-bar' is not a supported controller name; the
CamelCase form raises the same error. Rails 3.2 was lenient and
auto-normalized.
Common shapes that trigger the regex:
get "/", to: "my-pages#show" # hyphen
get "/", to: "MyPages#show" # CamelCase
URL paths (the route path itself) can keep hyphens — only the
controller class reference in `to:` needs to be snake_case. The fix
field calls this out so operators don't accidentally rewrite path
strings.
The snake_case form resolves to the same controller class on Rails
3.2, so the rewrite ships pre-bump and is backwards-compatible.
Classified high_priority / kind: breaking — Rails 4 boot raises on
the bad name.1 parent bb7c1c5 commit 142d137
1 file changed
Lines changed: 10 additions & 0 deletions
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
185 | 195 | | |
186 | 196 | | |
187 | 197 | | |
| |||
0 commit comments