Mike
Mike

Reputation: 137

Ruby on Rails 4 Routing

I want to have to url /pc/group/1 point to views/groups/show.html.erb. I'm not sure how to do this. I tried the following:

namespace :pc do
    resources :groups
end

resources :pc

But it results in can't find the page.

Upvotes: 0

Views: 35

Answers (1)

CDub
CDub

Reputation: 13354

You'd tell the route which controller and action to use in this situation:

namespace :pc, controller: 'groups' do
    resources :groups
end

resources :pc

Note that doing it this way, all routes for /pc/groups will point to the GroupsController, not just show.

Upvotes: 2

Related Questions