'companies#list' however, when I do this, the en...">

Hyphen in rails 3 routes

I would like to do the following

      match "company/client-list" => 'companies#list'

however, when I do this, the entry in the route table does not name the route, for example.

    /company/client-list(.:format) {:controller=>"companies", :action=>"list"}

as soon as I remove the hyphen in the agreed route, it will behave as expected

    company_clientlist /company/clientlist(.:format) {:controller=>"companies", :action=>"list"}

Anyone have any ideas on how to include hyphens in my mapped routes?

+3
source share
1 answer

And I have an answer:

match 'company/client-list' => 'companies#list', :as => 'client_list'

This makes the following entry in the route table

client_list /company/client-list(.:format) {:controller=>"companies", :action=>"list"}

Go team!

+2
source

Source: https://habr.com/ru/post/1767104/


All Articles