routing - Routes with Dash `-` Instead of Underscore `_` in Ruby on Rails -


I want underscore _ instead of using my url dash - For example> controller / my-action instead of controller / my_action as the word divider.

I am surprised about two things:

  1. Google et al continue to distinguish them from
  2. Is not a simple, global configuration parameter to map from code> - to _ or does it?

    I have the best solution : like or use a named route.

    I think that changing the railway route

    is there a better way >

    rail 3 and later you You can do this:

      Resources: user_bundles ,: path = & gt; '/ User-bundle'   

    Another option is to modify the rail through an initial medium. I do not recommend this though, because it breaks into future versions Could.

    It is better to use : path as shown above.

      Using a private API is not recommended and may break the rail versions in the future. #github.com/rails/rails/blob/4-1-stable/actionpack/lib/action_dispatch/routing/mapper.rb#L1012 ## Config / Analyzer / Adjust-Way-Path RB module Action Dispatch module routing class mapper module resource class resource DRF path @ path.dasherize end end end end end    

Comments