小编Die*_*cha的帖子

Rails 3资源路由,以param作为前缀

我的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>
Run Code Online (Sandbox Code Playgroud)

在我的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 => …
Run Code Online (Sandbox Code Playgroud)

parameters routes ruby-on-rails ruby-on-rails-3

4
推荐指数
1
解决办法
3179
查看次数