2

I'm trying to figure out the right way to use hyphens in Rails 4 view. If I create a controller view like this:

rails generate controller admin client_new

How then do I get the correct route output as:

http://www.website.com/admin/client-new

This is probably so basic, but I can't find the right doc's to support this.

Thanks,

BradM
  • 646
  • 8
  • 18

3 Answers3

3

If you have action for this client_new.html.erb in some controller, then simply map it manually:

get '/admin/client-new', to: 'controller#action'
Andrey Deineko
  • 51,333
  • 10
  • 112
  • 145
0

You will have to manually map the routes in the routes.rb file.

tagCincy
  • 1,589
  • 10
  • 20
0

Your route would need to be explicitly set to point to the proper controller. Something like:

get '/admin/client-new', to: "admin/client_new#index"

This will perform the index method on Admin::ClientNewController when a GET is performed on /admin/client-new

CDub
  • 13,146
  • 4
  • 51
  • 68