Rails Routes: Scope vs. Namespace
Like Pete, I often forget how scope
and namespace
affect Path, URL names and Controller names. Scope gives you great control over each aspect, while namespace takes one argument for everything.
scope 'url_prefix', module: 'controller_prefix', as: 'route_name_prefix' do
resources :posts
end
See his post, Scoping Rails Routes for detailed explanation with examples.