Reputation: 544
this is my code:
routes.rb
get '/admin', :to => "admin#index"
namespace :admin do
resources :questionnaires, :users, :campaigns
end
admin_controller.rb
class AdminController < ApplicationController
def index
end
end
campaigns_controller.rb
module Admin
class CampaignsController < AdminController
def index
end
def new
end
def create
end
def show
end
def edit
end
def update
end
def destroy
end
end
end
questionnaires and users controllers are exactly same of campaigns.
When i try to access to:
/admin/campaigns
The view is the index view of admin.
folder controller looks like that:
controllers
| admin
| campaigns_controller.b
| questionnaires_controller.rb
| users_controllers.rb
admin_controller.rb
folder views looks like that:
views
| index.html.haml
| admin
| questionnaires
| | index.html.haml
| users
| | index.html.haml
| index.html.haml
How i can separate my views for each resource ?
Upvotes: 0
Views: 67
Reputation: 15992
Try to change your routes to this:
namespace :admin do
resources :questionnaires, :users, :campaigns
end
get '/admin', :to => "admin#index" # this line at bottom
Upvotes: 1