开发者

rails: removing underscore from controller name

开发者 https://www.devze.com 2023-01-09 03:07 出处:网络
when I generate a two word named controller, like FooBar rails creates a controller and path like foo_bar this is not pretty. I would like to have the paths at least be FooBar开发者_JAVA百科.

when I generate a two word named controller, like FooBar rails creates a controller and path like foo_bar this is not pretty. I would like to have the paths at least be FooBar开发者_JAVA百科.

Possible? Suggestions?


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

# 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's slightly different in Rails 3.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号