Rails: removing underscore on behalf of the controller

when I generate two words with the name controller, for example, FooBarrails creates a controller and the path seems to be foo_bar, it’s not very. I would like to have ways, at least FooBar.

Possible? Suggestions?

+3
source share
1 answer

Depends on how your route is defined in route.rs. For instance:

# if you have named routes
map.foobar '/foobar/:action', :controller => 'foobar'

# if you have resources, this will generate
map.resources :foo_bar, :as => 'foobar'

This is for Rails 2.3. *, it is slightly different in Rails 3.

+3
source

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


All Articles