Skip to content

Instantly share code, notes, and snippets.

@agibralter
Created April 10, 2009 20:14
Show Gist options
  • Save agibralter/93271 to your computer and use it in GitHub Desktop.
Save agibralter/93271 to your computer and use it in GitHub Desktop.
# like reddit's sub-reddits located @ reddit.com/r/[name_of_reddit]
map.namespace :c, :path_prefix => 'c/:context_name' do |c|
c.default '', :controller => 'dashboards', :action => 'show'
c.resources :posts
c.resources :votes
c.namespace :admin do |c_admin|
c_admin.default '', :controller => 'dashboards', :action => 'show'
c_admin.resources :invitations
c_admin.resources :users
end
end
# app/
# controllers/
# sessions_controller.rb
# accounts_controller.rb
# c/
# base_controller.rb (C::BaseController < ApplicationController) => sets up a filters to scope current context
# dashboards_controller.rb (C::DashboardsController < C::BaseController)
# posts_controller.rb (C::PostsController < C::BaseController)
# votes_controller.rb (C::VotesController < C::BaseController)
# admin/
# base_controller.rb (C::Admin::BaseController < C::BaseController)
# users_controller.rb (C:Admin::UsersController < C::Admin::BaseController)
# invitations_controller.rb (C::Admin::InvitationsController < C::Admin::BaseController)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment