Rails 3:路由到客户区域 [英] Rails 3: routing to customer areas

查看:35
本文介绍了Rails 3:路由到客户区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Rails 3 初学者,但有使用其他 MVC Web 框架的经验,需要有关如何在 Rails 中设置路由的入门提示.该应用程序应允许用户注册,然后用户数据应可在以下 URL 处获得:

I'm a Rails 3 beginner, but have experiences with other MVC web frameworks and need a starting hint about how to setup my routing in Rails. The application should allow users to register and after that the users data should be available at URLs like:

http://域名/用户名/xyz

公共和用户独立部分应该在

The common and user independent part should be available at

http://域名/abc

为了区分两条路线,我会强制用户名至少有 6 个字符,所有abc"-routes 将有 5 个或更少.到目前为止,我将自己管理路由,但对于用户区域的xyz"部分,我想使用 rails 的现有 REST 完整功能.任何提示如何做到这一点?

To distinguis between both routes, I would force usernames to have at least 6 characters and all "abc"-routes will have 5 or less. Until this point I would be manage the routing by myself, but for the "xyz" part of the user area I would like to use the existing REST full features of rails. Any hint how to do that?

推荐答案

您是否已经阅读了http://edgeguides.rubyonrails.org/routing.html?

对于此类问题,这确实是一个很好的资源.我相信您描述的某些方案属于无资源"路由类别.

It's really a good resource for this sort of question. I believe some of the scheme you describe falls into the "Non-Resourceful" routing category.

这篇关于Rails 3:路由到客户区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆