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

You can overload controller and action names to use dashes:

# config/routes.rb
resources :my_resources, path: 'my-resources' do
  collection do
    get 'my-method', to: :my_method
  end
end

You can test in console:

rails routes -g my_resources
my_method_my_resources GET  /my-resources/my-method(.:format) my_resources#my_method

With Rails 3 and later you can do like this:

resources :user_bundles, :path => '/user-bundles'

Another option is to modify Rails, via an initializer. I don't recommend this though, since it may break in future versions (edit: doesn't work in Rails 5).

Using :path as shown above is better.

# Using private APIs is not recommended and may break in future Rails versions.
# https://github.com/rails/rails/blob/4-1-stable/actionpack/lib/action_dispatch/routing/mapper.rb#L1012
#
# config/initializers/adjust-route-paths.rb
module ActionDispatch
  module Routing
    class Mapper
      module Resources
        class Resource
          def path
            @path.dasherize
          end
        end
      end
    end
  end
end