I feel like this may be a dumb question, but it’s late and my head is melting a bit.. So I appreciate the assistance.
I’m trying to map the url http://localhost:3000/admin to a dashboard controller but i’m epically failing. Maybe this isn’t even possible or the completely wrong idea but anyway my routes looks like this and yes
namespace :admin do
resources :dashboard, { :only => [:index], :path => '' }
...
end
and my simple dashboard_controller.rb
class Admin::DashboardController < ApplicationController
before_filter :authenticate_user!
filter_access_to :all
def index
@schools = School.all
end
end
and my view is located in views/admin/dashboard/index.html.erb
thanks for any input
If all you’re trying to do is route
/adminto that dashboard controller, then you’re overcomplicating it by namespacing it like that.Namespacing with a nested resource like that would mean that it would be
/admin/dashboardsfor the:indexaction instead of having a clean/adminroute (and you can verify that by runningrake routesat the command line to get a list of your routes).Option 1: You meant to namespace it like that
Option 2: You didn’t mean to namespace it like that
Route:
Controller:
Views should be moved back to:
More info: http://guides.rubyonrails.org/routing.html