This project is archived and is in readonly mode.
Named Routes in routes.rb shows syntax error in actionpack
-
lakshmanan
It actually shows a syntax error. The title of this ticket should have been like "Named Routes in routes.rb shows syntax error actionpack"
-
Aditya Sanghi
- Title changed from Named Routes in routes.rb shows syntax actionpack to Named Routes in routes.rb shows syntax error in actionpack
- Importance changed from to Low
-
Andrew White
- State changed from new to open
- Milestone set to 3.x
- Assigned user changed from Santiago Pastorino to Andrew White
What's happening is the :as option is used as the named route helper method name. The fix is to raise an ArgumentError when the route is being defined if the :as option is not a valid method name. I'll fix this over the weekend.
-
Diego Carrion
I attached a patch in case the expected behavior is not to break.
-
Andrew White
Thanks, Diego but I think it's better to raise an exception - the name may be invalid for other reasons such as a leading number, space in the middle, etc.
-
lakshmanan
@Diego +1
I think, at least we must :strip the name before considering. Deigo's patch does exactly that.
-
Andrew White
But if you just strip the name your routes.rb file is left with an invalid argument - something I'd prefer to know.
-
Repository
- State changed from open to resolved
(from [2437c78f40d5e89aa3dc1c960bbe12fe0427b627]) Raise ArgumentError if route name is invalid [#6517 state:resolved] https://github.com/rails/rails/commit/2437c78f40d5e89aa3dc1c960bbe1...
-
Repository
(from [e00867bc437b6a681491ef59e13423051e6d98f0]) Raise ArgumentError if route name is invalid [#6517 state:resolved] https://github.com/rails/rails/commit/e00867bc437b6a681491ef59e1342...
-
Repository
(from [9cee693213e0205cb5992728bb516215e34cb79f]) Merge branch 'master' of github.com:rails/rails
- 'master' of github.com:rails/rails: (44 commits) Fixed indentation in actionmailer base_test [#6538 state:committed] remove unused assigned variable removes merge conflicts removes Examples headers introduced in 9b96de6 Revert "Fixed identation in actionmailer base_test" Report the correct value of nil.id in the exception message as different ruby implementations may have different values, for example Rubinius returns 53 for nil.id. Improve testing of cookies in functional tests: - cookies can be set using string or symbol keys - cookies are preserved across calls to get, post, etc. - cookie names and values are escaped - cookies can be cleared using @request.cookies.clear more style changes Some style changes style changes Revert "style changes" Raise ArgumentError if route name is invalid [#6517 state:resolved] style changes Allow model to be inherited from Hash [#6487 state:resolved] styles applied for usage added failing test for fields_for with a record object that inherits from Hash Fixed identation in actionmailer base_test wrong SQL statement commas to set off expressions that interrupt sentence flow typo changes ... https://github.com/rails/rails/commit/9cee693213e0205cb5992728bb516...
