This project is archived and is in readonly mode.
Application will die with syntax error when trying to define hyphenated resources
-
Carl
I'm also having the same problem, how can I define hyphened routes?
-
Carl
- Tag changed from resources hyphenated syntax error 3.0 beta to actionpack, hyphenatedroutes, router, routingerror
-
Lachlan Sylvester
Carl, have you tried resource :my_resource, :as => 'my-resource' ?
It would be nice is to could configure the router to generate routes with hyphens instead of underscores by default.
Camilo, are you just wanting hyphens in the urls? I can't see a reason that you would want to to define _path and _url methods with hyphens in them.
-
Camilo Lopez
Lachlan,
I don't really need hyphenated urls, what is important are the resource names, apparently what you suggested to Carl will be the perfect solution : :as => 'my-resource'
-
David Trasbo
- Assigned user set to Ryan Bigg
As suggested above this is definitely not a bug. There is no sense in defining a method with a hyphen in its name as the only way to call it is by using
send, which is obviously inconvenient. Use the:asoption. This ticket can be closed. -
Ryan Bigg
- State changed from new to invalid
-
Brent Greeff
- Importance changed from to Low
This is not working for me:
None of my hypenated roots are working under Rails 3 anymore:
resources :invitations, :as => 'send-invitation'
generates:
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/routing/route_set.rb:163:in
define_hash_access': compile error (SyntaxError)/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/routing/route_set.rb:161: syntax error, unexpected '-', expecting '\n' or ';' ... def hash_for_send-invitation_index_path(options
resources :invitations, :as => 'send_invitation'
Does not do what I want either, new_invitation_path is undefined?
and the urls have not changed. -
Brent Greeff
OK, figured it out,
resources 'send-invitation', :as => 'invitations', :controller => 'invitations'
does the trick.