【发布时间】:2011-06-11 07:31:54
【问题描述】:
我的 rails 3 应用在 Apache/mod_proxy 服务器的后台运行。
rails 应用中存在一个强制前缀 :site_pin
在 Apache 中,我有以下内容来抽象我的前缀:
ServerName example.com
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://localhost:3000/site/example/
ProxyPassReverse / http://localhost:3000/site/example/
<Location />
Order allow,deny
Allow from all
</Location>
在我的 routes.rb 中,我有以下内容:
resources :products
#RESTful fix
match 'site/:site_pin/:controller/', :action => 'index', :via => [:get]
match 'site/:site_pin/:controller/new', :action => 'new', :via => [:get]
match 'site/:site_pin/:controller/', :action => 'create', :via => [:post]
match 'site/:site_pin/:controller/:id', :action => 'show', :via => [:get]
match 'site/:site_pin/:controller/:id/edit', :action => 'edit', :via => [:get]
match 'site/:site_pin/:controller/:id', :action => 'update', :via => [:put]
match 'site/:site_pin/:controller/:id', :action => 'destroy', :via => [:delete]
以这种方式一切正常,但任何人都有更好的解决方案来删除此修复并让 routes.rb 更干净?
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-3 parameters routes