diff --git a/app/models/profile.rb b/app/models/profile.rb index d74765c..5e13a62 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -3,11 +3,21 @@ # which by default is the one returned by VirtualCommunity:default. class Profile < ActiveRecord::Base + # These names cannot be used as identifiers for Profiles + RESERVED_IDENTIFIERS = %w[ + admin + customize + cms + system + community + ] + has_many :domains, :as => :owner belongs_to :virtual_community validates_presence_of :identifier validates_format_of :identifier, :with => /^[a-z][a-z0-9_]+[a-z0-9]$/ + validates_exclusion_of :identifier, :in => RESERVED_IDENTIFIERS # creates a new Profile. By default, it is attached to the default # VirtualCommunity (see VirtualCommunity#default), unless you tell it diff --git a/config/routes.rb b/config/routes.rb index 2757e85..3a818ac 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -9,6 +9,12 @@ ActionController::Routing::Routes.draw do |map| # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase' # This route can be invoked with purchase_url(:id => product.id) + # administrative tasks for a virtual community + map.connect 'admin/:controller/:action/:id' + + # profile customization for profiles + map.connect 'customize/:profile/:controller/:action/:id' + # You can have the root of your site routed by hooking up '' # -- just remember to delete public/index.html. map.connect '', :controller => "home" @@ -19,4 +25,7 @@ ActionController::Routing::Routes.draw do |map| # Install the default route as the lowest priority. map.connect ':controller/:action/:id' + + # TODO: comatose here + end -- libgit2 0.21.2