Skip to content

Instantly share code, notes, and snippets.

@robotmay
Created January 30, 2010 13:03
Show Gist options
  • Save robotmay/290543 to your computer and use it in GitHub Desktop.
Save robotmay/290543 to your computer and use it in GitHub Desktop.
# In config/routes.rb:
map.namespace :admin do |admin|
admin.root :controller => :photographs
admin.resources :albums
admin.resources :categories
admin.resources :photographs
admin.resources :posts
end
# Inside /app/controllers I have a folder called admin, and inside that a controller called admin_controller.rb (/app/controllers/admin/admin_controller.rb):
class Admin::AdminController < ApplicationController
# You can put things like :require_user in here, as it will affect the whole admin panel
end
# Then all my admin controllers extend the admin_controller, here's an example:
class Admin::AlbumsController < Admin::AdminController
# Do stuff here!
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment