Namespaces and routing conventions
Clone this wiki locally
Tog and its plugins use different namespaces for their functionality, depending on the user’s role. They are: site, member and admin.
This namespace is the “public” face of the social network. Registered and not registered users can interact with any content in this area (if they are allowed to). For example, in a blog, they can see the blog’s posts, comment them, etc. Classes in this namespace normally fall into a plugin’s namespace, without any other special namespace (ex: Conversatio::BlogsController) and its routes doesn’t add any special folders:
In this area each user has access to its own content and data. For example, in a blog, a member will be able to add or edit a post, or approve moderated comments. If we are talking about groups, in this area a group moderator could approve new users, edit the group’s description, etc.
By convention, member controllers and actions live on “/member/PLUGIN/xxx” urls, for example:
These controllers are normally in the namespace Member::PLUGIN_NAME, and you’ll normally create one by extending the
Member::BaseControllerclass. For example:
This area is designed for the site & social network’s admins. The user has to be an admin of the site to be able to access this area.. For example, in a blog system, an administrator in this meta area will be able to suspend or delete a blog.
By convention, member controllers and actions should live on “/admin/PLUGIN/xxx” urls, for example:
These controllers are normally in the namespace Admin::PLUGIN_NAME, and you’ll normally create one by extending the
Admin::BaseControllerclass. For example:
Each of the namespaces uses its own layout for its content. This is added by just extending the BaseController of its namespace, so you don’t need to worry about it.
Just in case, there is one other layout, called session.html.erb which is used for sign-in and sign-up processes.